The "public" keyword is an access specifier,which allows the programmer to control the visibility of class members. When a class member is preceded by "public",then that member may be accessed by code outside the class in which it is declared. In this case,main() must be declared as "public",since it must be called by code outside of its class when the program is started. The keyword "static" allows main() to be called without having to instantiate a particular instance of class. This is necessary since main() is called by the JVM before any object are made.The keyword "void" simply tells the that main() doesnot return a value .As we will see, methods may also return values. "String args[]" declares a parameter named "args", which is an array of instance of the class "String".(Arrays are collections of similar objects). Objects of type "String" store character strings. In this case, "args" receives any command -line arguments present when the program is executed.
public means common for all classes. static means common for all objects. void means it did nt return any thing. Strung args[] is for what ever we enter through command line argument that will be collected in one arry i.e args[].
This uses public so that it is visible every where This is static so that to call this function we don't need to create the object of that class its belong to. It uses void to maintain a standard, because if we write int or char or anything else then it wont be proper function overloading. We use String arg[] to get any no. of argument that we want from the user,If we give different arguments then it means that we are overloading, to avoid it we have a standard.
In main method each word have specific meaning like we declare main method as public so that JVM will able to execute it(i.e. method will accessible outside the class in which it is declared).We declare it as static so that JVM will able to execute it without creating object of that class .we declare void to inform that main method doesn't return any value & args[] is array of type String which is called as command line argument & we can pass value at runtime to main method.
PUBLIC is used so that main can be accessed out of the class.
STATIC keyword is used so that main can be accessed without creating object of the class in which main is declared VOID is used because main is also a function and function should have return type MAIN-main is function from where our function starts and from main all other function are called String args[]-is used for the command line argument and is part of syntax of main,also String is a class in which any type of data type can be accepted.
public- main(..) is the first method called by java environment when a program is executed so it has to accessible from java environment. Hence the access specifier has to be public. static: Java environment should be able to call this method without creating an instance of the class , so this method must be declared as static. void: main does not return anything so the return type must be void. The argument String indicates the argument type which is given at the command line and arg is an array for string given during command line.
"public" means main method available any where inside or outside of the class. "static" it means that without using an object main method will be executed. "void" it means main method doesn't return any value.
string(args) it means it accepts data from outside into the method.It is string type arguments thier value passed to main method
static=because it can be call by without creating object of class public=can be accessed from anywhere void= return nothing main= to tell that it is entry point of program.
While developing one in JSP page we are sending request to Struts frame work.If we click two times submit button then First time only it should accept request and second time should reject that request in struts frame work.
How we can do that in controller itself...I am waiting for your Response...