public class E {

public static void main (String args[ ]) {

char 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); 

        break; 

   case 3: c = 'p';

        System.out.print(c); 

   default: System.out.print('好');

 }  

}

}

}运行结果内容:Jeep好

Java字符操作:switch语句示例

原文地址: https://www.cveoy.top/t/topic/bcxv 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录