Latest Tutorials| Questions and Answers|Ask Questions?|Site Map




Have Programming Question? Ask it here!
 
 
 


IMAMUL HAQUE
main function
2 Answer(s)      3 years and 7 months ago
Posted in : Java Beginners


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


Advertisement
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...



Related Tutorials/Questions & Answers:
main function
main function  Give me the description of public static void main(Strings args
Main function.. - Java Beginners
Main function..  Hi Friend.. public static void main(String args[]) What does it mean...public - static - void - main -(String args[]) Can u plz... return the value when it exits main(): This is the entry point for the application
Advertisements
main function in java - Java Interview Questions
main function in java  1....why is function main() define as static in java? 2...drawbacks of using rmi
main function defnition in class - Java Beginners
main function defnition in class  why do we use public infront of a main function   Hi friend, The main method is similar to the main function in C and C++; it's the entry point for your application
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
Main function parameter in C language - Ajax
Main function parameter in C language  Please let me know how this Main(int argc,char*argv[]) works and detailed example on their roles in command...; Hi Friend, int main(int argc, char **argv) The main function serves
How I call the function union from the main - Java Interview Questions
How I call the function union from the main  Please, from public static void main(String[] args) I would like to call the function union and I... declared in main function //------------------------------- package model
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
function
function  difference between function overloading and operator overloading
main method
main method  What is the argument type of a program's main() method
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 method
main method  hello, Can I make multiple main methods in the same... can not make multiple main with in the same class program fails to compile. Compiler gives error that the main method is already defined in the class
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
main func - Java Beginners
main func  why do we pass array of strings in main function of java?  Hi Friend, It is used to signify that the user may opt to enter parameters to the java program at command line. Thanks
Main method overloading
Main method overloading  Can we overload main()method
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
Main memory is also known as
Main memory is also known as   Main memory of a computer is also known
JSON main question
JSON main question  What is the main purpose of JSON ,in which cases can i use
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
public static void main
public static void main  what is mean public static void main?   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
What is the arguement of main method?
What is the arguement of main method?  hi, What is the arguement of main method? thanks,   Hi, For main() method accepts only an array of String object as arguement. For moe details on http://www.roseindia.net/java
Can a main method be overloaded?
Can a main method be overloaded?   Hi, Can a main method be overloaded? thanks,   Hi, Yes, In Java program we could having multiple number of main() methods with different Signature and implementation in the class
main() syntax - Java Beginners
main() syntax  Hi, I would like to know the complete structure of the main() in jdk1.5 with sample program. Regards, UsmanAli Shaik,  ...] [import statements] [class declaration] [main() method] For Example: package
Main features of JSP technology
Main features of JSP technology  Main features of JSP technology ?    A language for developing JSP pages, which are text-based documents that describe how to process a request and construct a response. Constructs
Exception in thread "main" java.lang.ClassCastException
Exception in thread "main" java.lang.ClassCastException  I am trying to connect the database. I am stuck with this exception that is getting thrown...){e.printStackTrace();} } } public static void main(String[] argv) { try { Class driver
Exception in thread "main" java.lang.ClassCastException
Exception in thread "main" java.lang.ClassCastException  I am trying to connect the database. I am stuck with this exception that is getting thrown...){e.printStackTrace();} } } public static void main(String[] argv) { try { Class driver
problem with main - Java Beginners
a problem. when i compile it appears this message: java.lang.NoSuchMethodError: main Exception in thread "main" . Should i put a main in another file? And how can..., This is an applet code and applet doesn't have main method therefore compile it and run
What is the main feature of Hibernate3?
What is the main feature of Hibernate3?  What is the main feature of Hibernate3?   Hibernate 3.0, the latest Open Source persistence technology. Features of Hibernate Hibernate 3.0 provides three full-featured query
java main program
java main program  how to write a main program for the following code public class JaroWinkler { private String compOne; private String compTwo; private String theMatchA = ""; private String theMatchB
create main page
create main page  <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@page import="java.sql.*"%> <%@page import="java.util.*"%> <%@ page session="true
Main topics in java for IT corporate working?
Main topics in java for IT corporate working?  What are the main and most important topics in java should be mastered that are usually incorporated in IT corporate world
When is java main method called?
When is java main method called?  When is java main method called? Please explain the main method in Java with the help of code.   In a java class, main(..) method is the first method called by java environment when
What if the main() method is declared as private?
What if the main() method is declared as private?  Hi, What if the main() method is declared as private? Thanks   Hi, I have found some reference site for java programming coding for Main() method is declared
What is the return type of the main method?
What is the return type of the main method?  hi, What is the return type of the main method? thanks   Hi, In the java programming the Main() method doesn't return anything hence declared void. In Java, you need
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
Why is the main method declared static?
Why is the main method declared static?  Hi, Why is the main method declared static? thanks   Hi, When we declare main() method in any Java class always has the same signature, and we declare public static void main
Can a main method be declared final?
Can a main method be declared final?   Hi, Can a main method be declared final? Thanks   Hi, Yes we can. The final method can... be override in a subclass. for more about main method be declared final in Java
Main Thread and Child Thread
There are two types of threads in Java Progarm In Java there are Main and Child Threads used in Programming. Main thread is automatically created when program runs. Child Thread gets created by the main thread . Java 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
isNaN function
isNaN function  What does isNaN function do
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
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
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
 

 

 

DMCA.com