package 上机练习;public class A02class { int random = (int) (Math.random() * 3 + 1); public String show1() { return "电脑出拳:石头"; } public String show2() { return "电脑出拳:剪刀"; } public String show3() { return "电脑出拳:布"; } public void show() { switch (random) { case 1: System.out.println(show1()); break; case 2: System.out.println(show2()); break; case 3: System.out.println(show3()); break; } }}package 上机练习;public class A02 { public static void main(String[] args) { // TODO Auto-generated method stub A02class A02=new A02class(); A02.show(); }}