passed stuff
stuff passed
passed An AssertionError is thrown with the word “stuff” added to the stack trace.
passed An AssertionError is thrown without the word “stuff” added to the stack trace.
passed An AssertionException is thrown with the word “stuff” added to the stack trace.
passed An AssertionException is thrown without the word “stuff” added to the stack trace.
第1题:
class DemoApp{ public static void main(String[] args){ int x = 5; int y = ++x + x++; S ystem.out.println(“y=”+y+”,x=”+x); } } 以上程序运行后的输出结果是哪项?()
第2题:
Given the command line java Pass2 and: public class Pass2 { public void main(String [] args) { int x=6; Pass2 p = new Pass2(); p.doStuff(x); System.out.print(” main x = “+ x); } void doStuff(int x) { System.out.print(” doStuffx = “+ x++); } } What is the result?()
第3题:
执行下面程序,显示的结果为( )。 public class Test { public static void main (String args[]) { Test t=newTest(); System.out.println (Loverload ("2","3")); } int overload (intx,int y) {return x+y;} String overload (String x,Stnng y){return x+y;} }
A.2
B.3
C.5
D.23
第4题:
class Top { static int x = 1; public Top(int y) { x *= 3; } } class Middle extends Top { public Middle() { x += 1; } public static void main(String [] args) { Middle m = new Middle(); System.out.println(x); } } 结果为:()
第5题:
public class Yippee { public static void main(String [] args) { for(int x = 1; x < args.length; x++) { System.out.print(args[x] +“ “); } } } and two separate command line invocations: java Yippee java Yippee 1234 What is the result?()
第6题:
public class Yippee2 { static public void main(String [] yahoo) { for(int x= 1; x
第7题:
public class Test { public static void main( String[] args) { String foo = args[1]; String bar = args[2]; String baz = args[3]; System.out.println(“baz = “ + baz); } } And the command line invocation: java Test red green blue What is the result?()
第8题:
public class AssertStuff { public static void main(String [] args) { int x= 5; int y= 7; assert (x> y): “stuff”; System.out.println(”passed”); } } And these command line invocations:java AssertStuff java -ea AssertStuff What is the result?()
第9题:
现有: class TestMain { static int x = 2; static { x = 4; } public static void main(String... args) { int y = x + 1; System.out.println(y); } } 和命令行: java TestMain 结果为:()
第10题:
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 结果为:()