题目内容

如果有以下关于对象创建的程序片段: 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;

选出如下表达式错误的

A. int z = '零';
B. float y = 12.345E2;
C. double a = 12;
D. int d = 5234567890;

请选出以下答案中x,y的值相等的答案

A. int x = 97; char y = 'a';
B. int x = 0; int y = '0';
C. int x = 0x100; char y = 100;
D. int a = 3+'5'; char b = '8';

答案查题题库