0

Every time I try to run a program,

Error: Main method not found in class program3, please define the main method as:

public static void main(String[] args)

An example would be:

public class program3 {
public static void main(String[] args) {
    System.out.println("Hello World");
}
}

Any help is appreciated, thanks in advance.

2
  • Welcome to Stack Overflow! It's not clear to me what you're asking -- perhaps you can provide some more context, or an example showing what you're looking for? Be sure also to check the question checklist. Thanks! Commented Nov 1, 2013 at 5:56
  • Refer this page stackoverflow.com/questions/11235827/… Commented Nov 3, 2013 at 2:39

2 Answers 2

1

Select the particular file and right click. Now you can see the run option. try this

Sign up to request clarification or add additional context in comments.

Comments

0

make sure that you are compiling the class. if you had not compiled the code and trying to execute an old version that was compiled before you inserted main might be causing the issue.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.