• Post Reply Bookmark Topic Watch Topic
  • New Topic

The system couldn't find a suitable main method  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

When I run the following program (through Jcreator), I get the message:
The system couldn't find a suitable main method or htm(l) file in the active project".
If someone has got a few minutes to spend in making me less ignorant, thank you.

import java.util.Scanner;
import static java.lang.System.*;


public class choice{

public static void main(String args[]){
Scanner myScanner=new Scanner(System.in);
out.println("If you want to make your brain to work, write 1");
int inputanswer=myScanner.nextInt();
if (inputanswer==1){
Scanner mysecondScanner=new Scanner(System.in);
out.println("2+2=?");
int answ=mysecondScanner.nextInt();
if (answ==4){
out.println("Right!");
}
else{
out.println("wrong");
}
}
else{
out.println("You're free");
}
}
}
 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome!

I'm not sure cause I didn't work with JCreator but I think you should check up your project settings. You might not specify the class wich has main method in it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!