设为首页 加入收藏

TOP

计算机二级考试辅导:Java猜拳游戏
2014-11-23 20:12:49 】 浏览:6145
Tags:计算机 二级 考试辅导 :Java 猜拳 游戏

  //Computer


  import java.util.Scanner;


  public class Computer {


  String name;


  int score;


  //方法


  public int showFist(){


  int fist=1;


  fist=(int)(Math.random()*10)%3+1;


  return fist;


  }


  }


   ------------------------------------------------------------------------------------------------------------------------------------


  //Person


  import java.util.*;


  public class Person {


  //属性


  String name;


  int score;


  //方法


  public int showFist(){


  int fist;


  Scanner input=new Scanner(System.in);


  System.out.println("请您出拳 1:剪刀 2 石头 3 布");


  fist=input.nextInt();


  return fist;


  }


  }


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇tomcat内存溢出总结 下一篇Java入门教程:Helloworld程序

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目