1、在学会了使用java编写hello world程序之后,我们学习了类,对象,for循环结构,switch结构,以及while结构,如此,我们开始编写一个小程序,用于模拟猜拳。

3、//switch的结构public static void printType(int g) { switch(g) { case 1: System.out.println("剪刀"); break; case 2: System.out.println("石头"); break; case 3: System.out.println("布"); break; } }

5、//这是对类的对象的使用Player player=new Player(); Player computer=new Player(); System.out.println("出拳规则:1.剪刀,2.石头,3.布"); System.out.println("请选择用户角色:1.张飞,2.曹操,3徐庶"); Scanner s=new Scanner(System.in);
