2014-12-05 42 views
-1

我試圖用Java編寫的一個小遊戲,它不斷彈出錯誤:爲什麼我找不到符號:in.nextInt錯誤?

cannot find symbol

in.nextInt

。我的代碼中有其他的in.nextInt,它工作正常,所以我有點難住。

import java.util.Scanner; 

public class Player 
{ 
    int difficult = 3; 

    public Player() 
    { 
    } 
    public void SetDifficult() 
    { 
     Scanner in = new Scanner(System.in); 
     System.out.println("choose your difficulty:\n1. simple\n2. easy\n3. normal\n4. hard\n5. impossible"); 
     difficult = in.nextint(); 
     ... 
} 

獲取此錯誤的原因是什麼?

+3

'in.nextInt();' – August 2014-12-05 00:50:11

+0

在javadoc的快速一瞥,就足以給你答案! – fge 2014-12-05 00:51:59

+0

現在我覺得很蠢 – dragsvart 2014-12-05 00:57:23

回答

1

您有:

in.nextint() 

你想:

in.nextInt() 

大寫我