+ 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)); }}

9th Oct 2017, 5:20 AM
Prashant Kumar
Prashant Kumar - avatar
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
9th Oct 2017, 6:32 AM
Ipang
+ 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..
9th Oct 2017, 8:10 AM
Ipang
+ 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.
9th Oct 2017, 10:23 AM
Ipang
+ 3
Ooh okay :D
9th Oct 2017, 12:19 PM
Ipang
+ 1
both have same name showing in error
9th Oct 2017, 6:22 AM
Prashant Kumar
Prashant Kumar - avatar
+ 1
@Ipang but it not works in command prompt , why ?
9th Oct 2017, 6:36 AM
Prashant Kumar
Prashant Kumar - avatar
+ 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
9th Oct 2017, 9:36 AM
Prashant Kumar
Prashant Kumar - avatar
0
@lpang I just reboot the system đŸ€ŁđŸ€ŁđŸ€Ł
9th Oct 2017, 11:48 AM
Prashant Kumar
Prashant Kumar - avatar
0
Error: Could not find or load main class adder.Adder
17th Jul 2018, 9:38 AM
fayis kottakkal
fayis kottakkal - avatar