Tuesday 19 July 2016

public static void main string args

Like c and c++ java program also have main() method to start you java program execution. But in java it is always not true, the execution starts from the main() and you also write a java program without main() but it is not possible in case of c and c++ languages.


Wen executing a java program, whether the class contain main () or not and whether the main() is properly declared or not, these checking are not performed by your java compiler at run time, JVM is responsible for these checking. If the JVM is unable to find the required main() them we will get run time exception saying: NoSuchMethodError:main


When the java program is running by the JVM it will always look for the following type of main().

public static void main( String args[])


public: It is a access specifier used to call by JVM from any where

static: It is a keyword used to execute the main() with calling using an object or to call a method when there is no object is created to that class.

void: void is a data type used in front of a method which does not return any value.

main: name of the method configured inside JVM

String args[] : command line arguments and they are of type string.



 

0 comments :

Post a Comment

Note: only a member of this blog may post a comment.

Machine Learning

More

Advertisement

Java Tutorial

More

UGC NET CS TUTORIAL

MFCS
COA
PL-CG
DBMS
OPERATING SYSTEM
SOFTWARE ENG
DSA
TOC-CD
ARTIFICIAL INT

C Programming

More

Python Tutorial

More

Data Structures

More

computer Organization

More
Top