Home > Back-end >  Java for help
Java for help

Time:09-25

This is why someone is also a this code but can run

CodePudding user response:

Public class to add the main method don't add the main method to the public can not find,,,,

CodePudding user response:

Are you sure someone else's code in the same way as you too?
Will you post code now, move the main method to the Parent class

CodePudding user response:

refer to the second floor qybao response:
are you sure someone else's code is also in the same way as you?
Will you post code now, move the main method to the Parent class for
uh-huh teacher unified to code

CodePudding user response:

These development tools actually some of the default rules, such as in the class file name with the same name with the search for the main () method, the filename you Parent. Java, will go to the Parent class to find the main () method, if you have to run that can run under the CMD try javac Parent. Java

CodePudding user response:

reference 4 floor m0_46365696 response:
Quote: refer to the second floor qybao response:
are you sure someone else's code is also in the same way as you?
Will you post code now, move the main method to the Parent class for
uh-huh teacher unified code to the


Your Java program name is wrong, the main method is to write you Child in the class, so the program name also if the Child, your Parent class without main
Methods of course can not run,

CodePudding user response:

Is can run, but you should pay attention to the content, you should always choose to run the Parent class, there are no main method in the Parent, you double-click on the main and then right click run to try, you see my code like you, but I run this, in fact, the main method of the running or child
  • Related