Your java class file name should be similar to your public class name, you can save your java file with different name also. Example : Your java file name is Employee.java and your class name is Emp
public class Emp{
}
You have to compile your class with javac Employee.java that will generate Emp.class file (because your .class file is generated with the class name) and you have to run this class file like java Emp.class
so you are compiling Employee.java and executing Emp.class that is not good practice, so it’s recommended that their should be
No comments:
Post a Comment