Today we are going to discuss about what is the basic structure of java and how actually the code works.

               Basic Java Structure

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


access-specifier class class-name
{
method 1{
statement 1;
statement 2;
}
method 2
{
statement 1;
statement 2;
}
}



 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.




Lets understand the basic concepts within the program

1.public specify the accessibility concept,that means who can access that class
2.class first- It specify that we have a class that name is “first”.Remember that every java program must have one unique class.Without class java program does not exist
3.public static void main(String args[])-It telling the system that there is no return type in main method and it have list of arguments that have string data type.
4.System.out.println sends the request to print something whitten between round braces .Remember that we can also write print instead of println.But the difference is,println gives the instruction to move to the next line cursor whereas the statement with print argument is appended on same line.
5.Everything is written between the opening and closing curly braces.

 INSTALL JDK IN YOUR SYSTEM->> How to install jdk in your system

If you face any problem while executing your first java program than write it in comment box.

By jigar

Leave a Reply

Your email address will not be published. Required fields are marked *