“一个Java源文件中可以有多个类,但只能有一个类是public的。”是否正确( )。
查看答案
"语句System.out.println(4+8+"Hello,world!");的输出结果是:48Hello,world!"是否正确( )。
如果有以下关于对象创建的程序片段: public class Test { private Test test; private Test () {} public static Test create() { if(test == null) { test = new Test (); } return test; } } 以下描述正确的是( )
A. 编译失败
B. 调用时必须使用new Test()产Test生实例
C. 调用时必须使用new Test ().create()产生Some实例
D. 调用时必须使用Test.create()产生Some实例
如果有以下关于构造函数的程序片段: public class Test { public int x; public Test (int x) { this.x = x; } } 以下描述正确的是( )
A. 建构Test时,可使用new Test ()或new Test (10)形式
B. 建构Test时,只能使用new Test ()形式
C. 建构Test时,只能使用new Test (10)形式
D. 没有无自变量建构式,所以编译失败
选出如下表达式错误的
A. boolean flag = 1;
B. byte b = 0x175;
C. char c = 100;
D. int x = 0x35f;