用下列哪个代码替换程序标注的【代码】会导致编译错误?public static void main(String args[]){int m=10,n=0;while(【】){n++}}}
A. m-->0
B. m++>0
C. m=0
D. m>100&&true
查看答案
假设有“x=1;”,以下哪个代码导致“不能从一个整型转换为字符型”这样的编译错误?
A. short t=12+'a'
B. char c='a'+1
C. char m='a'+x
D. byte n='a'+1
下面程序的运行结果是什么?public class t2 {public static void main(String[] args) {// TODO Auto-generated method stubchar x='你',y='e',z='吃';if(x>'A'){y='苹';z='果';}else {y='酸';}z='甜';System.out.print(x+","+y+","+z);}}
A. 你,苹,果
B. 你,苹,甜
C. 苹,果,甜
D. 苹,果,酸
public class t2 {public static void main(String[] args) {// TODO Auto-generated method stubchar c='0';for(int i=1;i<=4;i++)switch(i){case 1:c='J';System.out.print(c);case 2:c='e';System.out.print(c);case 3:c='p';System.out.print(c);default:System.out.print("好");}}}
A. Jep好ep好p好好
B. Jep好ep好p好
C. Jep好
D. ep好p好
public class t2 {public static void main(String[] args) {// TODO Auto-generated method stubint x=1,y=6;while(y-->0)x--;System.out.print("x="+x+" y="+y);}}
A. x=-5 y=0
B. x=-4 y=0
C. x=-5 y=-1
D. x=-4 y=-1