JAVA第三章课后习题答案

第一题:

public class disanzhangxiti1 { public static void main (String args[]) { char x='你',y='e',z='吃'; if(x>'A') { y='爱'; z='情'; } else y='我'; z='她'; System.out.println(\ } }

第二题:

public class disanzhangxiti2 { public static void main (String args[]) { char c='\\0'; for(int i=1;i<=4;i++) { switch(i) { case 1: c='b'; System.out.print(c); case 2: c='e'; System.out.print(c);

}

}

}

}

break;

case 3: c='p';

System.out.print(c);

default: System.out.print(\

第三题:

public class disanzhangxiti3 { public static void main (String args[]) { int sum=0,a=1; int i=1; while(i<=10) { sum=sum+a; i=i+1; a=a*i; } System.out.println(\ } }

第四题:

public class disanzhangxiti4

{ }

public static void main(String agrs[]) { int i,j,count=0; for(j=2;j<=100;j++) { for(i=2;i<=j/2;i++) { if(j%i==0) break; } if(i>j/2) { count++; System.out.println(\ } } System.out.println(\}

联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4