+ 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; } } }
18 Answers
+ 3
https://code.sololearn.com/cGBPuRS7r73h/?ref=app
no errors 🤷🏻♀️
+ 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
+ 1
Can you share code link by saving it...?
It's working fine in playground when I test it..
+ 1
Use
class as {
..
Instead of
public class as{
...
// remove public..
+ 1
Save it and run after change. ..
Are you tried it already?
+ 1
Yes
+ 1
I tried there. see output no errors:
screen shot.
https://www.sololearn.com/post/1707949/?ref=app
+ 1
How can send to you screenshot
+ 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..
+ 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
0
the Message is still there
0
What should i do
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...
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.