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? ()
Given:10. interface Data { public void load(); }11. abstract class Info { public abstract void load(); }Which class correctly uses the Data interface and Info class?()()
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 static void main(String[] args) { 12. Integer i = uew Integer(1) + new Integer(2); 13. switch(i) { 14. case 3: System.out.println(”three”); break; 15. default: System.out.println(”other”); break; 16. } 17. } 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.interface Data { public void load(); } 11.abstract class Info { public abstract void load(); } Which class correctly uses the Data interface and Info class?()
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?()
1. public class X { 2. public static void main (String[]args) { 3. int [] a = new int [1] 4. modify(a); 5. System.out.printIn(a[0]); 6. } 7. 8. public static void modify (int[] a) { 9. a[0] ++; 10. } 11. } What is the result?()
Given: 11. public void go(int x) { https://assets.asklib.com/images/image2/2018080117015876420.jpg Which statement is true?()
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?()
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?()
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? ()
1. public class Boxer1 { 2. Integer i; 3. int x; 4. public Boxer1(int y) { 5. x=i+y; 6. System.out.println(x); 7. } 8. public static void main(String[] args) { 9. new Boxer1(new Integer(4)); 10. } 11. } What is the result?()
现有: 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); } } 上述程序运行后的结果是哪项?()
1. public class test ( 2. public static void main(string args[]) { 3. int 1= 0; 4. while (i) { 5. if (i==4) { 6. break; 7. } 8. ++i; 9. } 10. 11. } 12. ) What is the value of i at line 10?()
阅读下列程序,请写出该程序的功能。import java. util.*;public class Class1{public static void main(Srting args[]){Date date1=new Date();System. out. println (datel);String t=datel.toString();int endPos=t.indexOf(`C');t=t.substring(11,endPos);System. out println(t);}}
以下代码的调试结果为?1: public class Q102: {3: public static void main(String[] args)4: {5: int i = 10;6: int j = 10;7: boolean b = false;8:9: if( b = i == j)10: System.out.println(\True\);11: else12: System.out.println(\False\);13: }14: }
Given the following code: 1)clss Person { 2) public void printVlue() ; 11)} 12)} Which method will the sttement on line 10 cll on line 2 B.on line 3 C.on line 6 D.on line 7
请将下列程序的空白处补充完整。 Import java.awt.*; Public class E11__4 Public static void main(String args) Frame f=new Frame("BorderLayout"); _________; f.add("North",new button("North")); f.add("East",new button("E
8、以下类的声明是完全正确的。 class mobile { private: char mynumber[11]; //机主的电话号码 public: void init(char number[11]=”0000000000”) //隐式定义的内联函数 void dial(); //拨打电话的函数声明 void answer(char othernumber[11]); //接听电话的函数声明 void hangup(); //挂断电话的函数声明 }