在下面的代碼中,我做了錯誤的事情。對不起,如果這是一個基本的。我得到這個工作的罰款,如果這一切都在一個班,但不是我在下面的代碼打破類像:Java,將字符串從一個類傳遞到另一個類
class Apples{
public static void main(String[] args){
String bucket = "green"; //instance variable
Apples appleOne = new Apples(); //create new object (appleOne) from Apples class
System.out.println("Paint apple one: " + appleOne.paint(bucket));
System.out.print("bucket still filled with:" + bucket);
}//end main
}//end class
class ApplesTestDrive{
public String paint(String bucket){
bucket = "blue"; //local variable
return bucket;
}//end method
}//end class
錯誤消息:
location:class Apples
cannot find symbol
pointing to >> appleOne.paint(bucket)
任何提示?
你會得到什麼錯誤? – EricBoersma 2010-10-01 15:09:21
@EricBoersma,它在底部,但我現在編輯了這個問題,使其脫穎而出。 – 2010-10-01 15:11:06