第3章
1.下列哪些语句有错误?
int x = 0;
x = 5.0/2;
float y = 12.5F;
y = 5.0/2;
2下列哪些语句有错误?
byte x = 32;
char c = ‘a’;
int n = c-x;
c = c-x;
3 对于一个整数m,m<<1的结果一定是2m吗? 4下列for语句的执行结果是什么?
for(int i=1; i<=4; i++)
{
switch(i)
{
case 1:
System.out.printf(“%c”, ‘a’);
case 2:
System.out.printf(“%c”, ‘b’);
break;
case 3:
System.out.printf(“%c”, ‘c’);
case 4:
System.out.printf(“%c”, ‘d’);
break;
}
}
5下列System.out.printf语句的输出结果是什么?
char a[] = {‘a’,’b’,’c’,’d’,’e’};