main function

main function

Give me the description of public static void main(Strings args[])

View Answers

February 2, 2011 at 2:11 PM

Hi Friend,

public-It indicates that the main() method can be called by any object.

static-It indicates that the main() method is a class method.

void- It indicates that the main() method has no return value.

(String args[])-It is used for receiving any arbitirary number of arguments and save it in the array.

Thanks


February 2, 2011 at 4:06 PM

public static void main(Strings args[])

As u knw that to write a main method we need a class...unlike C++ ...so once class is loaded main method also needs to be loaded so that compiler can run this method...and this is done if main is static coz for static we dont want an object of the class to be created ...it is loaded as soon as it compiles....so static is required

void is required coz it is starting point of application...so nothing will return from starting point

main is required coz compiler understands this method as starting method...

String args[] is an array of string which u can pass if u want to perforn some operation using these arguments...for eg if arg[0] is "hi" print "hi"..if arg[1] is "hello" print "hello"

public is required coz to access this main method it has to be visible by compiler and this is possible if it is public since private is visible only in that class...

Ads









Related Tutorials/Questions & Answers:
main function
main function  Give me the description of public static void main(Strings args
Understanding public static void main function
Understanding public static void main function       The public static void main function is important function in Java programming language. In this section we will learn about main
Advertisements
function
function  difference between function overloading and operator overloading
What is Public static void main
What is Public static void main In most of the Programming language, main function is the first function where program start execution. This is the first... are the variation of main method. public static void main(String[] args) public
main method
main method  Why is the java main method static
main() method
main() method  Can we define two main() methods having same parameter but with different return type in a program
MAin error
MAin error  Error while running hello program in another dir rather... but @ d tym of runnin error in main class is generated Exception in thread "main".java.lang.NoClassFoundDefLoader. : Hello caused
main method
main method  psvm(String args[]) what does this arguement in paranthesis denote?   Hi Friend, public-It indicates that the main() method can be called by any object. static-It indicates that the main() method
unoin function
unoin function  how to define a union function in java?(ex:a=a U b) how to write tha java code?give ex.   Java Union Function You have... sets. import java.util.*; public class SetsUnion { public static void main
function method
function method  i. void display(String str.int p)with one string... is an example where we have created a function that accepts a string and an integer... static void main(String[] args) { Scanner input=new Scanner(System.in
function addValue
function addValue  i have question about the javascript the function addvalue script is working to add some name but is not save on the html so please resolve my problem what can i do for addvalue function will be to save
function addValue
function addValue  i have question about the javascript the function addvalue script is working to add some name but is not save on the html so please resolve my problem what can i do for addvalue function will be to save
function addValue
function addValue  i have question about the javascript the function addvalue script is working to add some name but is not save on the html so please resolve my problem what can i do for addvalue function will be to save
using function
using function  write a program using function overloading to accept...(){ } } public class VowelsAndConsonants{ public static void main(String... class VowelsAndConsonants{ public static void main(String[] args)throws
Calling a function
Calling a function  Hi, I have a function xyz() in php code. When a button is clicked it should execute that particular function for that i have... function function xyz() { } but this is not working can u tell me
function method
function method  input Rs. 12000 Discount= 10%, 8% = Rs.(12000-1200) = Rs.(10800-864) = Rs. 9936
using function
using function   using a function to find the value of v from the foiiowing expression 1v=1u+1*f
If function in PHP
If function in PHP  Hi, Provide me the example of If function in PHP. Thanks   Hi, If function is PHP is used to check for some condition and the execute a block of code. He is an example of if() function in PHP
function method
function method  input Rs. 12000 Discount= 10%, 8% = Rs.(12000-1200) = Rs.(10800-864) = Rs. 9936
disable function
disable function  Sir, I have called a java script function when one radio button is checked i want to disable this function when another radio button is checked ,both radio buttons are of same group Please help Thanks in advance
why not float main?
why not float main?  why should the main be int or void?why cant it be float or char? why int main()?why not float main()?or char main
why not float main?
why not float main?  why should the main be int or void?why cant it be float or char? why int main()?why not float main()?or char main
JSON main question
JSON main question  What is the main purpose of JSON ,in which cases can i use
JSON main question
JSON main question  What is the main purpose of JSON ,in which cases can i use
Main memory is also known as
Main memory is also known as   Main memory of a computer is also known
ModuleNotFoundError: No module named 'main'
ModuleNotFoundError: No module named 'main'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'main' How to remove the ModuleNotFoundError: No module named 'main' error
ModuleNotFoundError: No module named 'main'
ModuleNotFoundError: No module named 'main'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'main' How to remove the ModuleNotFoundError: No module named 'main' error
Function pointer in c
Function pointer in c  What is the difference between function call with function pointer and without function pointer(normal function call
Main job of cpu
Main job of cpu  What is the Main Job of CPU?   The CPU perform two main task .. 1. It carry out program instructions and also 2. Process the data and information
java sleep in main method
java sleep in main method  Hi, How to write Java program for sleeping in the main method? I want Java program to have sleep in main method. Try to share me the code examples. Thanks
java sleep in main method
java sleep in main method  Hi, How to write Java program for sleeping in the main method? I want Java program to have sleep in main method. Try to share me the code examples. Thanks

Ads