We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents a76a73b + ba3eb87 commit e482230Copy full SHA for e482230
Number_Gusses.java
@@ -20,10 +20,12 @@ public Game() {
20
Random rand=new Random();
21
Computer_input = rand.nextInt(100);
22
}
23
+ //method for taking input from user
24
public void takeUserInput(){
25
Scanner input=new Scanner(System.in);
26
System.out.println("Enter the Number That you want to guess it :");
27
User_input=input.nextInt();
28
+ input.close(); //input closed
29
30
boolean isCorrectNumber(){
31
if(User_input==Computer_input){
@@ -42,8 +44,8 @@ else if (User_input>Computer_input){
42
44
public class Number_Gusses {
43
45
public static void main(String[] args) {
46
Game g=new Game();
- boolean b=false;
- while(!b){
47
+ boolean b=false;
48
+ while(!b){
49
g.takeUserInput();
50
b= g.isCorrectNumber();
51
System.out.println(b);
0 commit comments