1个回答
展开全部
package baiduzhidao;
import java.util.Scanner;
public class HelloWorld {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int code = 0;
while (code != 4) {
System.out.print("请输入操作代码(1,2,3) 输入4退出?");
code = scanner.nextInt();
switch (code) {
case 1: {
System.out.println("*");
System.out.println("***");
System.out.println("*****");
System.out.println("*******");
break;
}
case 2: {
System.out.println(" *");
System.out.println(" ***");
System.out.println(" *****");
System.out.println("*******");
break;
}
case 3: {
System.out.println("*******");
System.out.println(" *****");
System.out.println(" ***");
System.out.println(" *");
break;
}
case 4: {
continue;
}
}
}
scanner.close();
System.out.println("演示完毕!!!");
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询