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
金山職業技術學院對比四川汽車職業技術學院哪個好 附分..
時間:2025-05-22 09:08:12成都銀杏酒店管理學院在重慶高考招生計劃人數和專業代..
時間:2025-05-22 09:05:01四川上山東理工大學多少分 分數線及排名
時間:2025-05-22 09:01:18江西高考理科533分排名多少 排名多少位次
時間:2025-05-22 08:57:21大連東軟信息學院對比甘肅民族師范學院哪個好 附分數線..
時間:2025-05-22 08:53:39廣東高考455至460分左右物理可以上什么大學
時間:2025-05-22 08:49:52
中國點擊率最高的一篇文章 !2023-08-13 03:45:29
海南上長春工業大學多少分 分數線及排名2025-05-22 09:28:45
科爾沁藝術職業學院對比山東水利職業學院哪個好 附分數線排名2025-05-22 09:25:00
呼和浩特職業學院對比山西警官職業學院哪個好 附分數線排名2025-05-22 09:22:04
四川工程職業技術學院在上海高考招生計劃人數和專業代碼(參考)2025-05-22 09:19:52
泰山科技學院對比西安理工大學高科學院哪個好 附分數線排名2025-05-22 09:16:28
江西航空職業技術學院在云南高考招生計劃人數和專業代碼(參考)2025-05-22 09:13:20
遼寧特殊教育師范高等專科學校對比江西工商職業技術學院哪個好 附分數線排名2025-05-22 09:10:51
聯合利華(Unilever)校園招聘筆試真題2023-08-23 02:30:46
格力機械類筆試真題分享2023-08-12 04:32:32
德勤公司招聘的筆試推理題2023-08-27 04:13:57 




