Why When i run code show me this message: as class wasn't found in as project.select the main class:< no main classes found > | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why When i run code show me this message: as class wasn't found in as project.select the main class:< no main classes found >

import java.util.Scanner; public class as{ public static float sum (float x,float y ){ return x + y; } public static void main (String[]args ){ Scanner sc=new Scanner (System.in); float input =sc.nextFloat(); float output =sc.nextFloat(); char op = sc.next().charAt(0); switch(op){ case '+': System.out.println(sum(input,output)); break; } } }

30th Aug 2022, 3:18 PM
Fatma hgazy
Fatma hgazy - avatar
16 Answers
30th Aug 2022, 7:18 PM
**🇦🇪|🇦🇪**
**🇦🇪|🇦🇪** - avatar
+ 2
Maybe try a different compiler? The problem seems to be with ideone.com The program runs fine. I'd suggest downloading IntelliJ, Eclipse, or Visual Studio Code Java and installing a JDK on your machine (Java 8 or 11 should be fine) to run your programs on your local machine if possible. 5.5 3.3 + 8.8 Process finished with exit code 0 2.3 4.7 - Process finished with exit code 0 1 2 + 3.0 Process finished with exit code 0 (following is expected behavior) 6 j Exception in thread "main" java.util.InputMismatchException at java.base/java.util.Scanner.throwFor(Scanner.java:939) at java.base/java.util.Scanner.next(Scanner.java:1594) at java.base/java.util.Scanner.nextFloat(Scanner.java:2496) at as.main(as.java:12) Process finished with exit code 1
1st Sep 2022, 1:40 AM
Stephan Peters
Stephan Peters - avatar
+ 1
Can you share code link by saving it...? It's working fine in playground when I test it..
30th Aug 2022, 3:33 PM
Jayakrishna 🇮🇳
30th Aug 2022, 4:09 PM
Fatma hgazy
Fatma hgazy - avatar
+ 1
Use class as { .. Instead of public class as{ ... // remove public..
30th Aug 2022, 4:22 PM
Jayakrishna 🇮🇳
+ 1
Save it and run after change. .. Are you tried it already?
30th Aug 2022, 4:30 PM
Jayakrishna 🇮🇳
+ 1
Yes
30th Aug 2022, 4:33 PM
Fatma hgazy
Fatma hgazy - avatar
+ 1
I tried there. see output no errors: screen shot. https://www.sololearn.com/post/1707949/?ref=app
30th Aug 2022, 4:36 PM
Jayakrishna 🇮🇳
+ 1
How can send to you screenshot
30th Aug 2022, 4:40 PM
Fatma hgazy
Fatma hgazy - avatar
+ 1
I have taken screen shot and uploaded to feedpost and The link I copy pasted here.. But best is the original link as you shared..
30th Aug 2022, 4:42 PM
Jayakrishna 🇮🇳
+ 1
Make the name of main class similar for name of file (file. Java) If you save the all class in one folder, write the name of folder by english
1st Sep 2022, 5:56 AM
Abdalrahim Algaily
Abdalrahim Algaily - avatar
0
the Message is still there
30th Aug 2022, 4:24 PM
Fatma hgazy
Fatma hgazy - avatar
30th Aug 2022, 4:47 PM
Fatma hgazy
Fatma hgazy - avatar
0
What should i do
30th Aug 2022, 4:48 PM
Fatma hgazy
Fatma hgazy - avatar
0
This is where? Again seems like you not saved code.. Else now make main class public and save. Run it. see. Give inputs required...
30th Aug 2022, 4:54 PM
Jayakrishna 🇮🇳
0
still base found as not script base at found public intertainment. Design found not to et. Only design at else if not to understand as proove long cinema code else for the goddeless if i proove, if not say proove to user God. And all. Only God af is.
1st Sep 2022, 1:58 PM
Pavel Bondarenko
Pavel Bondarenko - avatar