现有:class Test2 fpublic static void main (String [] args) {short a,b,C;a=1;b=2;C=a+b;a+=2;}}以上代码中,哪一句是错误的?()
第1题:
阅读下面程序 public class Test2______ { public static void main(String[] args){ Thread t=new Test2(); t. start(); } public void run(){ System. out. priatln("How are you. "); } } 在程序下画线处填入的正确的选项是
A.implements Thread
B.extends Runnable
C.implements Runnable
D.extends Thread
第2题:
下列代码的执行结果是( )。 public class Test2 { public static void main(String arg[]) { System.out.println(100%3); System.out.println(100%3.0); }}
A.1和1
B.1和1.0
C.1.0和1
D.1.0和1.0
第3题:
( 8 )阅读下列代码
public class Test2{
public static void main(String args[]){
System.out.println(5/2);}}
其执行结果是 【 8 】 。
第4题:
Which statement about static inner classes is true?()
第5题:
现有: class Tree { private static String tree = "tree "; String getTree () { return tree; } } class Elm extends Tree { private static String tree = "elm "; public static void main (String [] args) { new Elm() .go (new Tree()) ; } } void go (Tree t) { String s = t.getTree () +Elm.tree + tree + (new Elm() .getTree ()) ; System.out.println (s) ;} 结果为:()
第6题:
Static Nested Class 和 Inner Class 的不同。
参见前面的什么是内部类的那道题
第7题:
阅读下面程序 public class Test2 ______ { public static void main(String[] args) { Thread t=new Test2(); t.start(); } public void run() { System.out.println("How are you."); } } 程序中下画线处应填入的正确选项是
A.implements Thread
B.extends Runnable
C.implements Runnable
D.extends Thread
第8题:
阅读下面程序
public class Test2{
public static void main(String args[]){
int a=10,b=4,c=20,d=6;
System.out.println(a++*b+c*-d);
}
}
程序运行的结果是
A)144
B)160
C)140
D)164
第9题:
现有: class TestMain { static int x = 2; static { x = 4; } static public void main(String[] args) { int y = x + 1; System.out.println(y); } } 和命令行: java TestMain 结果为:()
第10题:
package test1; public class Test1 { static int x = 42; } package test2; public class Test2 extends test1.Test1 { public static void main(String[] args) { System.out.println(“x = “ + x); } } What is the result?()