PARTS OF JAVA PROGRAM Class Name – Indicates the name of the class. – The class uses an access specifier public, which indicates that our class in accessible to other classes from other.
PARTS OF JAVA PROGRAM Start of a Block (Class) – Indicates the beginning of a class .
PARTS OF JAVA PROGRAM Method Name – The main method is the starting point of a Java program.
PARTS OF JAVA PROGRAM Start of a Block (Method) – Indicates the beginning of a method.
PARTS OF JAVA PROGRAM Body – It consists of statements and compound statements.
PARTS OF JAVA PROGRAM Close of the Blocks ; Close the class and method respectively.
JAVA Main Method public static void main(String args[]) − Java program processing starts from the main() method which is a mandatory part of every Java program. Let's split it and understand one by one. 1. public- Here public is an access specifier which allows the main method to be accessible everywhere. 2. static- static helps main method to get loaded without getting called by any instance/object. 3. void- void clarifies that the main method will not return any value. 4. main- It's the name of the method. 5. String[] args- Here we are defining a String array to pass arguments at command line. args is the variable name of the String array. It can be changed to anything such as String [] a.
SEMICOLON (;) It shows the compiler where an instruction ends and where the next instruction begins
Saving your project in Java A Java class file is a file (with the .java class filename extension) containing Java bytecode that can be executed on the Java Virtual Machine (JVM). A Java class file is usually produced by a Java compiler from Java programming language source files