单项选择题

What will be written to the standard output when the following program is run?()  
public class Q8499 {  
public static void main(String args[]) { 
double d = -2.9;  
int i = (int) d; 
i *= (int) Math.ceil(d); 
i *= (int) Math.abs(d);  
System.out.println(i); 
 } 
 }

A.12
B.18
C.8
D.9
E.27


您可能感兴趣的试卷

你可能感兴趣的试题

2.多项选择题Which of these statements concerning the collection interfaces are true?()  

A.Set extends Collection.
B.All methods defined in Set are also defined in Collection.
C.List extends Collection.
D.All methods defined in List are also defined in Collection.
E.Map extends Collection.

4.多项选择题Which statements describe guaranteed behavior of the garbage collection and finalization mechanisms?()  

A.Objects are deleted when they can no longer be accessed through any reference.
B.The finalize() method will eventually be called on every object.
C.The finalize() method will never be called more than once on an object.
D.An object will not be garbage collected as long as it is possible for an active part of the program to      access it through a reference.
E.The garbage collector will use a mark and sweep algorithm.

5.多项选择题Which statements concerning the value of a member variable are true, when no explicit assignments have been made?()  

A.The value of an int is undetermined.
B.The value of all numeric types is zero.
C.The compiler may issue an error if the variable is used before it is initialized.
D.The value of a String variable is "" (empty string).
E.The value of all object variables is null.

7.多项选择题Given two collection objects referenced by col1 and col2,which of these statements are true?()

A.The operation col1.retainAll(col2) will not modify the col1 object.
B.The operation col1.removeAll(col2) will not modify the col2 object.
C.The operation col1.addAll(col2) will return a new collection object, containing elements from both col1      and col2.
D.The operation col1.containsAll(Col2) will not modify the col1 object.

8.多项选择题

Which statements concerning the following code are true?()  
class a {  
public a() {}  
public a(int i) { this(); }  
}  
class b extends a {  
public boolean b(String msg) { return false; } 
 }  
class c extends b 
{  private c() { super(); } 
 public c(String msg) { this(); } 
 public c(int i) {} 
 }  

A.The code will fail to compile.
B.The constructor in a that takes an int as an argument will never be called as a result of constructing an     object of class b or c.
C.Class c has three constructors.
D.Objects of class b cannot be constructed.
E.At most one of the constructors of each class is called as a result of constructing an object of class c.

10.单项选择题

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.