D.8
8:
String s=”Example String”;Which operation is not legal?
String s=”Example String”;Which operation is not legal?
A.int i=s.length();
B.s[3]=”x”;
C.String short_s=s.trim();
D.String t=”root”+s;
9:
Give this class outline:
class Example{
private int x;
//rest of class body…
}
Assuming that x invoked by the code java Example, which statement can made x be directly accessible in main() method of Example.java?
Give this class outline:
class Example{
private int x;
//rest of class body…
}
Assuming that x invoked by the code java Example, which statement can made x be directly accessible in main() method of Example.java?
A.Change private int x to public int x
B.change private int x to static int x
C.Change private int x to protected int x
D.change private int x to final int x
10:
What will happen when you attempt to compile and run the following code?
class Base
{
int i = 99;
public void amethod()
{
System.out.println("Base.amethod()");
}
Base()
{
amethod();
}
}
public class Derived extends Base
{
int i = -1;
public static void main(String argv[])
{
Base b = new Derived();
System.out.println(b.i);
b.amethod();
}
public void amethod()
{
System.out.println("Derived.amethod()");
}
}
Choices:
What will happen when you attempt to compile and run the following code?
class Base
{
int i = 99;
public void amethod()
{
System.out.println("Base.amethod()");
}
Base()
{
amethod();
}
}
public class Derived extends Base
{
int i = -1;
public static void main(String argv[])
{
Base b = new Derived();
System.out.println(b.i);
b.amethod();
}
public void amethod()
{
System.out.println("Derived.amethod()");
}
}
Choices:
A.Derived.amethod() -1 Derived.amethod()
B.Derived.amethod() 99
C.Compile time error
D.Derived.amethod()
11:
What will be the result of executing the following code?
// Filename; SuperclassX.java
package packageX;
public class SuperclassX
{
protected void superclassMethodX()
{
}
int superclassVarX;
}
// Filename SubclassY.java
2020年河北新聞網兩學一做
時間:2023-09-18 07:0:242020年河北新聞網兩學一做
時間:2023-09-15 11:0:59兩學一做學習教育知
時間:2023-09-21 06:0:302020年開展兩學一做學習教
時間:2023-09-19 21:0:30
聯合利華(Unilever)校園招聘筆試真題2023-09-15 18:31:24
格力機械類筆試真題分享2023-09-21 16:59:47
陜西國際商貿學院在重慶高考專業招生計劃(人數+代碼)2025-05-22 10:38:12
安徽建筑大學和新余學院哪個好 分數線排名對比2025-05-22 10:36:54
襄陽職業技術學院廣西錄取分數線及招生人數 附-2020最低位次排名2025-05-22 10:35:29
長江大學和新疆師范大學哪個好 分數線排名對比2025-05-22 10:34:16
錦州師范高等專科學校在遼寧高考專業招生計劃(人數+代碼)2025-05-22 10:32:49
山東高考排名在17550的考生能報什么大學(原創)2025-05-22 10:31:33
廣州華立學院的英語專業分數線(附2020-最低分排名怎么樣)2025-05-22 10:30:14
蘭州石化職業技術大學的理化測試與質檢技術專業分數線(附2020-最低分排名怎么樣)2025-05-22 10:29:06
泉州師范學院和亳州學院哪個好 分數線排名對比2025-05-22 10:27:53
貴州醫科大學在江西高考專業招生計劃(人數+代碼)2025-05-22 10:26:23
東莞城市學院和西安工商學院哪個好 分數線排名對比2025-05-22 10:24:51
山東海事職業學院的水路運輸安全管理專業分數線(附2020-最低分排名怎么樣)2025-05-22 10:23:44 


