第十四周 P187教材检查

在IDEA中或命令行中运行P187 Guess.java。

这道题是继承语法抽象类一块的知识点,题目本身其实并不难,但是当时做的时候我找自己原来的代码花了很长时间,刚找到运行完截好图,就到时间了。


当时我之所以没能成功提交的原因有以下几个原因:

1.我没有及时找到我原来的代码,所以寻找就花了一大部分的时间。
2.我在运行的时候出了一点小问题,好像是运行指令的问题,但是当时也没来得及截图,所以只能描述了。
3.我发现截图打水印其实也是很花时间的,后来我都由用PS加水印改成了直接在截图时手写。

package Inheritance;
import java.util.Scanner;

public class Guess {
   public static void main(String[] args) {
   Scanner scanner = new Scanner(System.in);
   int number = (int) (Math.random() * 10);
   int guess;
  
   do {
      System.out.print("guess the number(0~9):");
      guess = scanner.nextInt();
   }while(guess != number);
   System.out.println("guess right~!");
   }
}

(修改于2017/6/24)

posted @ 2017-06-10 21:17  xuanyan  阅读(158)  评论(2编辑  收藏  举报