Simple Java Program or Structure of Java Programming

Simple Java Program or Structure of Java Programming-:
[Note-:
In java we can not Start a progrram without Class.]


Structure-:

Class  class_name
{
public Static void main(String args[ ])
{
\\set of instruction
}
}


Explanation-

  1. Void main () must be public because it must be accessed outside the class and start the progrram execution .
  2. Void main() must be static bcoz it must be available before object creation.
[Note-:  
if we declare any component in java as static that is available before object creation.]
    
   3.Main () method must be void because it's non-return type method.
    4.In java void main is by default command line argument programe ,which is passed  with String arrray as parameter .

We can use keyword Static & public interchanging.

0 comments:

Post a Comment

Enter Here Your Ideas and Comment to improve this Blog

Popular Posts

Nilesh Jha. Powered by Blogger.

Contact Form

Name

Email *

Message *

Copyright © Nilesh Jha's Blog |
|