JAVA Classes
2 min readJul 26, 2020
Creating a JAVA class
- Every Java code is defined in classes.
- Classes are defined in the source code file with extension .java.
- JAVAC command is used to compile your JAVA code, and it also creates a file with extensions .class, which is interpreted by JVM,
- then JAVA command is used to run the compiled byte code file.
Most of the beginners will have a dought that can we have Multiple main methods or can a java file have multiple classes with a “public” modifier ??
- One JAVA file can consist of Many class with one main Method, the Main method is nothing but it is the entry point of the Application
- but there must be at most one public class file if there is a public file that must be similar to the file name else if no public class exists file name can by be any...
- .class files are created for every class in JAVA.
After Compilation 3 .class files are generated …
when
- java Main1
- java Main2