Basic Java Structure
What is a source file in java?
A source file is the file that holds one class definition . The class represent the piece of your program.The class must go within a pair of curly braces.It is essential that we have to save source file with .java extension.
What is inside the class?
A class have one or more methods that are performing some specific operation.The methods must be declared inside the class.Remember that class name and source file name must be same.
What is the meaning of method?
The method is also known by function name.Method have list of statements that are for some specific operation.The list of statements are written inside the pair of curly braces.
Remember one thing that hen we execute our program via command line ,it searching for one specific line from which our main starts and that line is
public static void main(String args[])
It is the main method that is exist in every class.
Basic java syntax
Your first simple java program is here
CODE->>>>
public class first{
public static void main(String args[])
{
System.out.println(“The Idle Coder”);
}
}
Output->>>>
The Idle Coder.