Error

class Test{
private int g=0;
void Do(int input){
g=input+1000;
System.out.println(g);
}
int Get(){
return g;
}
}

public class Main {
public static void main(String[] args) {

Test test=new Test();

test.Do(5);

int result=test.Get();

System.out.println(result+"...");
}
}
class Test{
private int g=0;
void Do(int input){
g=input+1000;
System.out.println(g);
}
int Get(){
return g;
}
}

public class Main {
public static void main(String[] args) {

Test test=new Test();

test.Do(5);

int result=test.Get();

System.out.println(result+"...");
}
}
i get: Exception in thread "main" java.lang.NoSuchMethodError: 'void Test.Do(int)' at Main.main(Main.java:17) how can i fix this ?
6 Replies
JavaBot
JavaBot2y ago
This post has been reserved for your question.
Hey @MoonSouhayl! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
MoonSouhayl
MoonSouhaylOP2y ago
ye
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
MoonSouhayl
MoonSouhaylOP2y ago
oh wait ye i found the problem im stupid i had another file called Test opened and it had the Test class
JavaBot
JavaBot2y ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one.
Want results from more Discord servers?
Add your server