单选题What will be the result of attempting to compile and run the following code?() public class Q6b0c { public static void main(String args[]) { int i = 4; float f = 4.3; double d = 1.8; int c = 0; if (i == f) c++; if (((int) (f + d)) == ((int) f + (int) d)) c += 2; System.out.println(c); } }AThe code will fail to compile.B0 will be written to the standard output.C1 will be written to the standard output.D2 will be written to the standard output.E3 will be written to the standard output.
单选题
What will be the result of attempting to compile and run the following code?() public class Q6b0c { public static void main(String args[]) { int i = 4; float f = 4.3; double d = 1.8; int c = 0; if (i == f) c++; if (((int) (f + d)) == ((int) f + (int) d)) c += 2; System.out.println(c); } }
A
The code will fail to compile.
B
0 will be written to the standard output.
C
1 will be written to the standard output.
D
2 will be written to the standard output.
E
3 will be written to the standard output.
参考解析
解析:
暂无解析
相关考题:
Given:What is the result when the programmer attempts to compile the code and run it with the command java Converter 12?() A. It is true that j==i.B. It is false that j==i.C. An exception is thrown at runtime.D. Compilation fails because of an error in line 13.
public class foo { public static void main (Stringargs) { String s; system.out.printIn (“s=” + s); } } What is the result?()A、 The code compiles and “s=” is printed.B、 The code compiles and “s=null” is printed.C、 The code does not compile because string s is not initialized.D、 The code does not compile because string s cannot be referenced.E、 The code compiles, but a NullPointerException is thrown when toString is called.
class MyThread extends Thread { public void run() { System.out.println(“AAA”); } public void run(Runnable r) { System.out.println(“BBB”); } public static void main(String[] args) { new Thread(new MyThread()).start(); } } What is the result?() A、 AAAB、 BBBC、 Compilation fails.D、 The code runs with no output.
What will be the result of attempting to run the following program?() public class Qaa75 { public static void main(String args[]) { String[][][] arr = { { {}, null }, { { "1", "2" }, { "1", null, "3" } }, {}, { { "1", null } } }; System.out.println(arr.length + arr[1][2].length); } } A、The program will terminate with an ArrayIndexOutOfBoundsException.B、The program will terminate with a NullPointerException.C、4 will be written to standard output.D、6 will be written to standard output.E、7 will be written to standard output.
public class Foo { public void main (String args) { system.out.printIn(“Hello World.”); } } What is the result? () A、 An exception is thrown.B、 The code does no compile.C、 “Hello World.” Is printed to the terminal.D、 The program exits without printing anything.
What will be the result of attempting to compile and run the following code?() public class Q6b0c { public static void main(String args[]) { int i = 4; float f = 4.3; double d = 1.8; int c = 0; if (i == f) c++; if (((int) (f + d)) == ((int) f + (int) d)) c += 2; System.out.println(c); } } A、The code will fail to compile.B、0 will be written to the standard output.C、1 will be written to the standard output.D、2 will be written to the standard output.E、3 will be written to the standard output.
Which of the following best describes what is meant by Linux Affinity on AIX?()A、The ability to install a Linux system on an AIX systemB、The ability to install an AIX system on a Linux systemC、The ability to compile and run a Linux application on AIXD、The ability to compile and run an AIX application on Linux
What will be the result of attempting to compile and run the following program?() public class Q28fd { public static void main(String args[]) { int counter = 0; l1: for (int i=10; i0; i--) { l2: int j = 0; while (j 10) { if (j i) break l2; if (i == j) { counter++; continue l1; } } counter--; } System.out.println(counter); } } A、The program will fail to compile.B、The program will not terminate normally.C、The program will write 10 to the standard output.D、The program will write 0 to the standard output.E、The program will write 9 to the standard output.
String foo = “blue”; Booleanbar = new Boolean [1]; if (bar[0]) { foo = “green”; } What is the result?() A、 Foo has the value of “”B、 Foo has the value of null.C、 Foo has the value of “blue”D、 Foo has the value of “green”E、 An exception is thrown.F、 The code will not compile.
int index = 1; String [] test = new String[3]; String foo = test[index]; What is the result?() A、 Foo has the value “”B、 Foo has the value nullC、 An exception is thrownD、 The code will not compile
Given the following directory structure: bigProject |--source ||--Utils.java| |--classes |-- And the following command line invocation: javac -d classes source/Utils.java Assume the current directory is bigProject,what is the result?()A、If the compile is successful, Utils.class is added to the source directory.B、The compiler returns an invalid flag error.C、If the compile is successful, Utils.class is added to the classes directory.D、If the compile is successful, Utils.class is added to the bigProject directory.
单选题Click the Exhibit button. What is the result?()A The code will deadlock.B The code may run with output "2 0 6 4".C The code may run with no output.D The code may run with output "0 6".E An exception is thrown at runtime.F The code may run with output "0 2 4 6".
单选题What will be the result of attempting to compile and run the following program?() public class Q28fd { public static void main(String args[]) { int counter = 0; l1: for (int i=10; i i) break l2; if (i == j) { counter++; continue l1; } } counter--; } System.out.println(counter); } }AThe program will fail to compile.BThe program will not terminate normally.CThe program will write 10 to the standard output.DThe program will write 0 to the standard output.EThe program will write 9 to the standard output.
单选题String foo = “blue”; Boolean[]bar = new Boolean [1]; if (bar[0]) { foo = “green”; } What is the result? ()A Foo has the value of “”B Foo has the value of null.C Foo has the value of “blue”D Foo has the value of “green”E An exception is thrown.F The code will not compile.
单选题What is the result( )?A The program prints “0”.B The program prints “4”.C The program prints “8”.D The program prints “12”.E The code does not compile.
单选题What is the result?()A foo has the value””B foo has the value null.C An exception is thrown.D The code will not compile.
单选题Given the following directory structure: bigProject |--source ||--Utils.java| |--classes |-- And the following command line invocation: javac -d classes source/Utils.java Assume the current directory is bigProject,what is the result?()AIf the compile is successful, Utils.class is added to the source directory.BThe compiler returns an invalid flag error.CIf the compile is successful, Utils.class is added to the classes directory.DIf the compile is successful, Utils.class is added to the bigProject directory.
单选题What will be the result of attempting to run the following program?() public class Qaa75 { public static void main(String args[]) { String[][][] arr = { { {}, null }, { { "1", "2" }, { "1", null, "3" } }, {}, { { "1", null } } }; System.out.println(arr.length + arr[1][2].length); } }AThe program will terminate with an ArrayIndexOutOfBoundsException.BThe program will terminate with a NullPointerException.C4 will be written to standard output.D6 will be written to standard output.E7 will be written to standard output.
单选题Which of the following best describes what is meant by Linux Affinity on AIX?()AThe ability to install a Linux system on an AIX systemBThe ability to install an AIX system on a Linux systemCThe ability to compile and run a Linux application on AIXDThe ability to compile and run an AIX application on Linux
单选题public class foo { public static void main (string[]args) try {return;} finally {system.out.printIn(“Finally”);} } What is the result?()A The program runs and prints nothing.B The program runs and prints “Finally”C The code compiles, but an exception is thrown at runtime.D The code will not compile because the catch block is missing.
单选题11. class Converter { 12. public static void main(String[] args) { 13. Integer i = args[0]; 14. int j = 12; 15. System.out.println(”It is “ + (j==i) + “that j==i.”); 16. } 17. } What is the result when the programmer attempts to compile the code and run it with the command java Converter 12?()A It is true that j==i.B It is false that j==i.C An exception is thrown at runtime.D Compilation fails because of an error in line 13.
单选题public class Foo { public void main (String [] args) { system.out.printIn(“Hello World.”); } } What is the result?()A An exception is thrown.B The code does no compile.C “Hello World.” Is printed to the terminal.D The program exits without printing anything.
单选题public class foo { public static void main (Stringargs) { String s; system.out.printIn (“s=” + s); } } What is the result?()A The code compiles and “s=” is printed.B The code compiles and “s=null” is printed.C The code does not compile because string s is not initialized.D The code does not compile because string s cannot be referenced.E The code compiles, but a NullPointerException is thrown when toString is called.
单选题int index = 1; String test = new String; String foo = test[index]; What is the result?()A Foo has the value “”B Foo has the value nullC An exception is thrownD The code will not compile
单选题int index = 1; String [] test = new String[3]; String foo = test[index]; What is the result?()A Foo has the value “”B Foo has the value nullC An exception is thrownD The code will not compile
单选题What is the result()?A 2B 4C 8D 16E The code will not compile.