网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
单选题
Float pi = new Float(3.14f); if(pi>3) { System.out.print(”pi is bigger than 3. “); } else { System.out.print(”pi is not bigger than 3. “); } finally { System.out.println(”Have a nice day.”); } What is the result?()
A
Compilation fails.
B
pi is bigger than 3.
C
An exception occurs at runtime.
D
pi is bigger than 3. Have a nice day.
E
pi is not bigger than 3. Have a nice day.
参考答案
参考解析
解析:
暂无解析
更多 “单选题Float pi = new Float(3.14f); if(pi3) { System.out.print(”pi is bigger than 3. “); } else { System.out.print(”pi is not bigger than 3. “); } finally { System.out.println(”Have a nice day.”); } What is the result?()A Compilation fails.B pi is bigger than 3.C An exception occurs at runtime.D pi is bigger than 3. Have a nice day.E pi is not bigger than 3. Have a nice day.” 相关考题
考题
单选题Given the following code: if (x0) { System.out.println("first"); } else if (x-3) { System.out.println("second"); } else { System.out.println("third"); } Which range of x value would print the string "second"?()A
x 0B
x -3C
x = -3D
x = 0 x -3
考题
单选题1. public class X implements Runnable( 2. private int x; 3. private int y; 4. 5. public static void main(String[]args) 6. X that = new X(); 7. (new Thread(that)).start(); 8. (new Thread(that)).start(); 9. ) 10. 11. public void run() ( 12. for (;;) ( 13. x++; 14. y++; 15. System.out.printIn(“x=” + x + “, y = ” + y); 16. ) 17. ) What is the result?()A
Errors at lines 7 and 8 cause compilation to fail.B
The program prints pairs of values for x and y that might not always be the same on the same line (for example, “x=2, y=1”).C
The program prints pairs of values for x and y that are always the same on the same line (for example, “x=1, y=1”. In addition, each value appears twice (for example, “x=1, y=1” followed by “x=1, y=1”).D
The program prints pairs of values for x and y that are always the same on the same line (for example, “x=1, y=1”. In addition, each value appears only for once (for example, “x=1, y=1” followed by “x=2, y=2”).
考题
多选题class One { public One foo() { return this; } } class Two extends One { public One foo() { return this; } } class Three extends Two { // insert method here } Which two methods, inserted individually, correctly complete the Three class?()Apublic void foo() { }Bpublic int foo() { return 3; }Cpublic Two foo() { return this; }Dpublic One foo() { return this; }Epublic Object foo() { return this; }
考题
单选题Given the following code: public class Person{ int arr[] = new int[10]; public static void main(String a[]) { System.out.println(arr[1]); } } Which statement is correct?()A
When compilation some error will occur.B
It is correct when compilation but will cause error when running.C
The output is zero.D
The output is null.
考题
多选题public class Parent { public int addValue( int a, int b) { int s; s = a+b; return s; } } class Child extends Parent { } Which methods can be added into class Child?()Aint addValue( int a, int b ){// do something...}Bpublic void addValue (){// do something...}Cpublic int addValue( int a ){// do something...}Dpublic int addValue( int a, int b )throws MyException {//do something...}
考题
单选题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?()A
The value “4” is printed at the command line.B
Compilation fails because of an error in line 5.C
Compilation fails because of an error in line 9.D
A NullPointerException occurs at runtime.E
A NumberFormatException occurs at runtime.F
An IllegalStateException occurs at runtime.
考题
单选题11. String test= “a1b2c3”; 12. String[] tokens = test.split(”//d”); 13. for(String s: tokens) System.out.print(s +“ “); What is the result?()A
a b cB
1 2 3C
a1b2c3D
a1 b2 c3E
Compilation fails.F
The code runs with no output.G
An exception is thrown at runtime.
考题
单选题Given the ActionEvent, which method allows you to identify the affected component?()A
GetClass.B
GetTarget.C
GetSource.D
GetComponent.E
GetTargetComponent.
热门标签
最新试卷