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=”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
福建农林大学(较高收费)农林经济管理专业怎么样排名好不好 附录取分数线2026-11-09 17:44:35
福建农林大学(较高收费)农业资源与环境专业怎么样排名好不好 附录取分数2026-11-09 17:44:29
荆州学院王牌重点专业有哪些 开设专业排名表2026-10-27 09:20:35
呼伦贝尔学院王牌重点专业有哪些 开设专业排名表2026-10-27 09:20:31
内蒙古大学创业学院王牌重点专业有哪些 开设专业排名表2026-10-27 09:20:16
山东青年政治学院王牌重点专业有哪些 开设专业排名表2026-10-27 09:20:10
湖北幼儿师范高等专科学校王牌重点专业有哪些 开设专业排名表2026-10-27 09:19:49
贵州财经职业学院王牌重点专业有哪些 开设专业排名表2026-10-27 09:19:45
苏州科技大学王牌重点专业有哪些 开设专业排名表2026-10-27 09:19:27
电子科技大学中山学院王牌重点专业有哪些 开设专业排名表2026-10-27 09:19:18
淮南师范学院王牌重点专业有哪些 开设专业排名表2026-10-27 09:19:08
山东工艺美术学院王牌重点专业有哪些 开设专业排名表2026-10-27 09:18:59
外交学院王牌重点专业有哪些 开设专业排名表2026-10-27 09:18:42
吉林省经济管理干部学院王牌重点专业有哪些 开设专业排名表2026-10-27 09:18:32 


