Saturday, October 22, 2011

who is he?

Who is he ? guess and send an place the answer is the comment below and win an exciting offer of either key or trail reset of Kaspersky Antivirus or Trust Port Total Protection.

This starts from today. Try to guess a familiar person and win a serial key.

Place answer along with your name as "answer-name" in the comments section. 

Sunday, July 3, 2011

WHAT IS THE MEANING OF public static void main(String args[])

Some one explain what is means of static and (String arg[]) use in java.
public static void main (String arg[])
Why this term is used in java program?
this is command line argument ..
when we define any fun by static then we this is call automatically

public-----bcz main() is called by jvm which is totally an external code......
static------bcz main function should be one unique function in memory......
void----main() in java is not supposed to return ant status message to OS like C,C++....so return type is void.....
String args[]-------to accept command line arguements.....

public means our program is available to JVM to execute. Because JVM is also another program.If main method is not declared as public then JVM fails to execute main method


static means without creating object execute that method.To create object main has to execute.Without object it is not possible to execute main method.To avoid this problem static keyword is used that means main method is executed without object.
void means it doesn't return any value
String args[] used for taking command line arguments.
static public void main(String args[])....Valid
public static void main(String x[])....These are also valid in java

static is used to avoid any chance of multiple main threads....just to avoid object creation,static is nowhere used...Even As a programmer,we think of using static only when we want only one copy of dat variable or method in memory....