已知如下类说明public class Test {private float f = 1.0;int m = 12;static int n=1;public static void main(String arg[]) {Test t = new Test();____________________________.} }在空格处如下哪个使用是错误的?().
A. this.m
B. t.f
C. t.m
D. n
查看答案
(double)(5/2)的值为?(B)
A. 2
B. 2.0
C. 2.5
D. 3
运行如下程序时,显示什么结果?()classTest{public static void main(String[] args) {try {method();System.out.println("After the method call");}catch (NumberFormatException ex) {System.out.println("NumberFormatException");}catch (RuntimeException ex) {System.out.println("RuntimeException");}} static void method() {String s = "5.6";Integer.parseInt(s); // Cause a NumberFormatExceptionint i = 0;int y = 2 / i;System.out.println("Welcome to Java");}}
A. 程序显示 NumberFormatException.
B. 程序显示NumberFormatException followed by After the method call.
C. 程序显示NumberFormatException followed by RuntimeException.
D. The program has a compilation error.
E. 程序显示RuntimeException.
有以下方法的定义,请选择该方法的返回类型(D)ReturnType method(byte x, double y) {return (short)x/y*2;}
A. byte
B. short
C. int
D. double
以下代码的输出结果为:()public class Test { public static void main(String[] args) { Object o1 = new Object(); Object o2 = new Object(); System.out.print((o1 == o2) + " " + (o1.equals(o2))); }
A. false false
B. true true
C. false true
D. true false