Given: 10. class One { 11. void foo() { } 12. } 13. class Two extends One { 14. //insert method here 15. } Which three methods, inserted individually at line 14, will correctly complete class Two?()
11. public static void main(String[] args) { 12. Object obj = new Object() { 13. public int hashCode() { 14. returns 42; 15. } 16. }; 17. System.out.println(obj.hashCode()); 18. } What is the result? ()
10. public class ClassA { 11. public void count(int i) { 12. count(++i); 13. } 14. } And: 20. ClassA a = new ClassA(); 21. a.count(3); Which exception or error should be thrown by the virtual machine?()
Given: 11. public static void main(String[] args) { 12. Object obj = new int[] { 1, 2, 3 }; 13. int[] someArray = (int[])obj; 14. for (int i : someArray) System.out.print(i + " "); 15. } What is the result? ()
11. public void addStrings(List list) { 12. list.add(”foo”); 13. list.add(”bar”); 14. } What must you change in this method to compile without warnings?()
Given: 10.public void service(ServletRequest request, 11.ServletResponse response) { 12.ServletInputStream sis = 13.// insert code here 14.} Which retrieves the binary input stream on line 13?()
11. public class Test { 12. public void foo() { 13. assert false; 14. assert false; 15. } 16. public void bar(){ 17. while(true){ 18. assert false; 19. } 20. assert false; 21. } 22. } What causes compilation to fail?()
public class Threads5 { public static void main (String[] args) { new Thread(new Runnable() { public void run() { System.out.print(”bar”); } }).start(); } } What is the result?()
10. public class Bar { 11.static void foo(int...x) { 12. // insert code here 13. } 14. } Which two code fragments, inserted independently at line 12, will allow the class to compile?()
现有: class TestApp{ public static void main (String[] args){ int [5] myarray={ 10, 11, 12, 13, 14); int sum=0; for (int x : myarray) sum+=x; System. out. println( "sum= "+sum); } } 上述程序运行后的结果是哪项?()
11. public static void append(List list) { list.add(”0042”); } 12. public static void main(String[] args) { 13. List intList = new ArrayList(); 14. append(intList); 15. System.out.println(intList.get(0)); 16. } What is the result?()
t 是一个合法的 Thread 对象的引用,并且 t 的合法 run() 方法如下: public void run() { System.out.print("go "); } 及: t.start(); t.start(); t.run(); 哪一个是结果?()
11.public static void main(String[]args){ 12.Object obj=new int[]{1,2,3}; 13.int[] someArray=(int[])obj; 14.for(inti:someArray)System.out.print(i+"") 15.} What is the result?()
public class Foo implements Runnable ( public void run (Thread t) { system.out.printIn(“Running.”); } public static void main (String args) { new thread (new Foo()).start(); } ) What is the result?()
11. public static void main(String[] args) { 12. Object obj =new int[] { 1,2,3 }; 13. int[] someArray = (int[])obj; 14. for (int i: someArray) System.out.print(i +“ “) 15. } What is the result? ()
10. class Foo { 11. static void alpha() { /* more code here */ } 12. void beta() { /* more code here */ } 13. } Which two are true?()
现有: class TestApp{ public static void main (String[] args){ int [5] myarray={ 10, 11, 12, 13, 14); int sum=0; for (int x : myarray) sum+=x; System. out. println( "sum= "+sum); } } 上述程序运行后的结果是哪项?()
Runnable r = new Runnable() { public void run() { System.out.print(”Cat”); } }; Threadt=new Thread(r) { public void run() { System.out.print(”Dog”); } }; t.start(); What is the result?()
以下程序的输出结果为______。 void main() { int a[3][4]={{1,3,5,7},{9,11,13,15},{17,19,21,23}}; int i=2,j=3; int (*p)[4]=a; printf(%d\n,*(*(p+i)+j)); }
设有如下程序:public class Test5 {public static void main (String args []) {/* This is the start of a commentif (true) {Test5 = new test5();System.out.println(Done the test);}/* This is another comment */System.out.println (The end);}}结果为?
设有如下程序: public class Test5 { public static void main (String args []) { /* This is the start of a comment if (true) { Test5 = new test5(); System.out.println(\Done the test\); } /* This is another comment */ System.out.println (\The end\); } } 结果为?
1.publicclassXimplementsRunnable(2.privateintx;3.privateinty;4.5.publicstaticvoidmain(String[]args)6.Xthat=newX();7.(newThread(that)).start();8.(newThread(that)).start();9.)10.11.publicvoidrun()(12.for(;;)(13.x++;14.y++;15.System.out.printIn(x=”+x+,y=”+y);16.)17.)Whatistheresult?()
计算(1+12+13+14)×(12+13+14+15)-(1+12+13+14+15)×(12+13+14)的值是()。A.1B.14C.15D.0
使下列程序正常运行并且输出“Hello!”,横线处应填写的内容是()。 class Test { public static void main(string[]args){ Test t=new Test; start; } Public void run{ System.out.println("Hello!¨); )