Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training  
 

Java Question What is Public, Static, void and main

Ads

 
 

Share on Google+Share on Google+

Mano Chithra
Java Question What is Public, Static, void and main
2 Answer(s)      9 years ago
Posted in : Java Beginners

Can anyone please explain the meaning of public static and void main in Java?

Ads
View Answers

April 1, 2008 at 9:26 PM


Public - Means every user can use the method, class or variables whether it's a member or non member

Static - Value can't be changed

Void - not returnable

main - is a function to execute

(string args[])

string - datatype

and args[ ] - use to pass arguments


May 26, 2013 at 8:49 PM


public : to be searched by the JVM easily as public can be accessible from anywhere.

static: so that main method is loaded at the compile time with the class, because JVM searches the main method during run time, so we have to load main method at the class loading time means at compile time.

void: return type not to fix otherwise we had to return something.

main: name of the method.

String []arg :It is the parameters for main method of an Array of String type. Just String is used so that the application can take any type of input as every type of datatype can be converted into String easily.


Ads









Related Tutorials/Questions & Answers:
public static void main
public static void main  what is mean public static void main?  ... information, visit the following link: Understanding public static void main.... static-It indicates that the main() method is a class method. void- It indicates
JAVA what is different between static block and public static void main(String a[]) method
JAVA what is different between static block and public static void main(String a[]) method  what is different between static block and public static... block) why need of public static void main(String [])?   Static blocks
Advertisements
Static keyword in public static void main
= a * 4; } public static void main(String args[]) { meth(42); } } In the above...Static keyword in public static void main  Hi, I have seen... { static int a = 3; static int b; static void meth(int x) { System.out.println("x
Understanding public static void main function
Understanding public static void main function       The public static void main function is important.... Read more about public static void main function at http://www.roseindia.net
What is Public static void main
What is Public static void main In most of the Programming language, main... in java using main method. class Helloworld { public static void main(String... are the variation of main method. public static void main(String[] args) public
What happen when we write static public void instead of public static void?
What happen when we write static public void instead of public static void?  Hi, What happen when we write static public void instead of public.../gettingstartedwithjava/public-static-void-main.shtml   Hi
Why we are writting public static void main(String args[])?
Why we are writting public static void main(String args[])?  Why we are writting public static void main(String args[])? please elaborate it... and also explain the statement System.out.println("abc
Accessing non-static members through the main method in Java.
Accessing non-static members through the main method in Java.  ... it is permanently public static void... methods. If it is so, an obvious question arises as to how can the main() method
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
What are the main disadvantages of Java Server Faces 2.0?
What are the main disadvantages of Java Server Faces 2.0?  What are the main disadvantages of Java Server Faces 2.0
what is static synchronizes - Java Interview Questions
what is static synchronizes   what is static method...://www.roseindia.net/java/java-methods/java-method-synchronized.shtml http://www.roseindia.net/java/thread/synchronization.shtml Thanks
Can we replace main() with static block or with other static methods?
Can we replace main() with static block or with other static methods?  what is the use of public static void main()?can't we achieve the same thing through static block or through other static methods
In Java, what's the difference between public, default, protected, and private?
In Java, what's the difference between public, default, protected, and private?  In Java, what's the difference between public, default, protected, and private
Void class in Java - Java Beginners
Void class in Java  Hi, What is the purpose of Void class? Thanks   Hi Friend, It is an uninstantiable class that hold a reference to the Class object representing the primitive Java type void. Thanks
java question - Java Beginners
Java Question What is Public, Static, void and main  Can anyone please explain the meaning of public static and void main in Java?  Public - Means every user can use the method, class or variables whether it's a member
static & instance - Java Beginners
is: " + count); // } public static void main(String[] args... { private static int noOfObjects; private int count; public Main...static & instance  what is different between static variable
void Java Keyword
void Java Keyword       The void is a keyword defined in the java programming language. Keywords... in java programming language likewise the void keyword indicates the following
core java, static - Java Beginners
"); } public static void main(String args[]) { Static st1 = new Static... ( Ultimately this is what we do in static main method). So is right to say.... //Static.java public class Static { static void stat() { Static st1
What is the importance of static variable?
What is the importance of static variable?  hi, What is the importance of static variable? thanks
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
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
Core Java Interview Question Page 8
;    Question: What are the static fields & static... Example Java Code static int counter = 0; A public static field... java.lang.Short void java.lang.Void Question: What
class static - Java Beginners
"); } public static void main(String[] args) { //i=100; j...; public static void staticMethod(){ System.out.println("you can access a static method this way"); } public void nonStaticMethod(){ i=100
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
What is static factory pattern?
What is static factory pattern?  Hello, please tell me what is static factory pattern? Thank you..   Dear friend, you can go through the following links to better understand the static factory pattern - Factory
static in java
static in java  what is the need to go static? what use
java question related to objects
java question related to objects  what is the output of the following code? public class objComp { Public static void main(String args[]) { Int result = 0; objComp oc= new objComp(); object o = oc; if( o==oc) result =1; if(o
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...   Hi friend, public: The method can be accessed outside the class
STATIC
static block"); } public static void helloMethod() { System.out.println("Hello from static method"); } public static void main(String[] args) { helloMethod...STATIC  WHAT IS STATIC BLOCK?EXPLAIN , AND WHAT IS THE DIFFERENCE
What is the main feature of Hibernate3?
What is the main feature of Hibernate3?  What is the main feature... or local Java API, including a second-level cache browser. Eclipse support... timings as it supports inheritance, polymorphism, composition and the Java