指出下列程序的输出结果是什么? public static void main(String args[]){ final int A = 4; int a = 2; switch(a*2){ case A:System.out.println(a); default:System.out.println(a*2); } }
A.2
B.4
C.2和4
D.编译出错
- · 有3位网友选择 C,占比37.5%
- · 有3位网友选择 A,占比37.5%
- · 有2位网友选择 D,占比25%
A.2
B.4
C.2和4
D.编译出错
A、运行出错
B、出现编译错误
C、输出 0
D、输出 null
A、编译通过,但在//3处加上 ft.num ++; 后编译报错
B、编译通过,但在//3处加上 ft = new FinalTest(); 后编译报错
C、编译不通过,去除//1的 final 后编译通过
D、编译不通过,删除//2 整行后编译通过
A、3 3 0
B、1 2 0
C、2 1 0
D、编译报错
8、下列选项中,关于运算符“^”的描述正确是
A、二进制位有1,则结果为1
B、二进制位有0,则结果为0
C、二进制位有相同,则结果为1,不同为0
D、二进制位有相同,则结果为0,不同为1
下列程序的输出结果为 class Box{ int length,width,height; public void setInfo(int l,int w,int h){ length = l; width = w; height = h; } public int volumn(){ return length*width*height; } public int area(){ return (length*width + length*height + width*height) * 2; } public String toString(){ return "Length:" + length + " width:" + width + " height:" + height + " volumn: " + volumn() + " area:" + area(); } } public class BoxTest { public static void main(String[] args) { Box b = new Box(); b.setInfo(5,2,4); System.out.println(b.toString()); } }
A、This is a test file This is a test file Please print this file
B、This is a test filePlease print this file This is a test file Please print this file
C、['This is a test filePlease print this file']
D、This is a test filePlease print this file
A、float foo = -1;
B、float foo = 1.0;
C、float foo = 42e1;
D、float foo = 2.02f
为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!