2017-02-19 73 views
-1

我正在做一個tic tac腳趾遊戲。這是代碼的一部分,用於檢查哪個按鈕已被按下,並查看該按鈕中是否有圓或十字。如果有一個圓或十字,那麼玩家必須選擇另一個按鈕。錯誤:沒有找到合適的方法toString(字符串)

錯誤消息:

Error:(140, 38) error: no suitable method found for toString(String) 
method Arrays.toString(long[]) is not applicable 
(argument mismatch; String cannot be converted to long[]) 
method Arrays.toString(int[]) is not applicable 
(argument mismatch; String cannot be converted to int[]) 
method Arrays.toString(short[]) is not applicable 
(argument mismatch; String cannot be converted to short[]) 
method Arrays.toString(char[]) is not applicable 
(argument mismatch; String cannot be converted to char[]) 
method Arrays.toString(byte[]) is not applicable 
(argument mismatch; String cannot be converted to byte[]) 
method Arrays.toString(boolean[]) is not applicable 
(argument mismatch; String cannot be converted to boolean[]) 
method Arrays.toString(float[]) is not applicable 
(argument mismatch; String cannot be converted to float[]) 
method Arrays.toString(double[]) is not applicable 
(argument mismatch; String cannot be converted to double[]) 
method Arrays.toString(Object[]) is not applicable 
(argument mismatch; String cannot be converted to Object[]) 

我已經得到了這個錯誤,但不知道什麼是錯。

代碼:

   @Override 
       public String toString() { 
        return Arrays.toString(Circle); 
        return Arrays.toString(Cross); 
       } 
+1

它看起來像'Circle'和/或'Cross'是一個字符串。你爲什麼要調用'Arrays.toString()'?你的目標是什麼?你能告訴我們更多的代碼嗎? – shmosel

回答

0

有不止一個錯誤。 首先,不能有兩個返回語句!其次,你的圓和十字似乎是字符串,但Arrays.toString()期望一個數組作爲參數! 請提供完整的代碼。

相關問題