单项选择题
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
点击查看答案&解析
相关考题
-
填空题
Whatisthenameofthemethodthatthreadscanusetopausetheirexecutionuntilsignalledtocontinuebyanotherthread?()Fillinthenameofthemethod(donotincludeaparameterlist). -
多项选择题
Whichofthesestatementsconcerningthecollectioninterfacesaretrue?()
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. -
单项选择题
Which code fragments will succeed in printing the last argument given on the command line to the standard output, and exit gracefully with no output if no arguments are given?() CODE FRAGMENT a: public static void main(String args[]) { if (args.length != 0) System.out.println(args[args.length-1]); } CODE FRAGMENT b: public static void main(String args[]) { try { System.out.println(args[args.length]); } catch (ArrayIndexOutOfBoundsException e) {} } CODE FRAGMENT c: public static void main(String args[]) { int ix = args.length; String last = args[ix]; if (ix != 0) System.out.println(last); } CODE FRAGMENT d: public static void main(String args[]) { int ix = args.length-1; if (ix > 0) System.out.println(args[ix]); } CODE FRAGMENT e: public static void main(String args[]) { try { System.out.println(args[args.length-1]); }catch (NullPointerException e) {} }
A.Code fragment a.
B.Code fragment b.
C.Code fragment c.
D.Code fragment d.
E.Code fragment e.
