+ 1
Why this code giving error --- Could not find or load main class TestOverloading1.java
class Adder{ static int add(int a,int b){return a+b;} static int add(int a,int b,int c){return a+b+c;} } class TestOverloading1{ public static void main(String[] args){ System.out.println(Adder.add(11,11)); System.out.println(Adder.add(11,11,11)); }}
9 Answers
+ 5
@Prashant Kumar, here's a minor modification of your code, it works in Playground.
Hth, cmiiw
https://code.sololearn.com/cGToN2c7NYR8/?ref=app
+ 3
@Prashant, was there any error in the command prompt? if there was error can you tell the message? idk why, if it works in Code Playground I guess it should work in other ways, I could be wrong though..
+ 3
@Prashant, glad to hear that, oh btw, would you share with me the problem and solution you found for the command prompt, it maybe useful in case I get that same problem in the future.
+ 3
Ooh okay :D
+ 1
both have same name showing in error
+ 1
@Ipang but it not works in command prompt , why ?
+ 1
@lpang thank you now it's working on command prompt, it was showing error could not find or load main class due to command prompt problem , but now solved
0
@lpang I just reboot the system đ€Łđ€Łđ€Ł
0
Error: Could not find or load main class adder.Adder