2015-10-18 42 views
2

我不斷收到找不到符號錯誤的。我已經嘗試了以前沒有運氣的一切建議。我覺得我錯過了一些非常簡單的事情!找不到符號變量鍵盤掃描儀型號

import java.util.Scanner; 

public class XXX 
{ 
    public static void main(String[] args) 
    { 
     String playerName1; 
     final int MIN_SCORE = 19; 
     final int MAX_SCORE = 51; 
     int score; 

     Scanner keyboard = new Scanner(System.in); 

     System.out.println(); 
     System.out.print("Enter you name: "); 
     playerName1 = keyboard.next(); 

     System.out.print("Welcome" + playerName1 + "to the game of guts! "); 

     System.out.println(); 

     System.out.print("Enter winning Score(between 20 - 50): "); 
     score = keyboard.Int(); 

    } 
} 



ProgrammingProject3.java:36: error: cannot find symbol 
     score = keyboard.Int(); 
        ^
    symbol: method Int() 
    location: variable keyboard of type Scanner 
+3

它的'''keyboard.nextInt();''' – Siddhartha

回答

1

一個Scanner確實沒有一個int()方法。它被稱爲nextInt()

+0

我知道我可以俯瞰簡單的東西!謝謝! –