Java Question What is Public, Static, void and main

Java Question What is Public, Static, void and main

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

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.









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... this: public static void main(String args[]) The method signature for the main
What is Public static void main
What is Public static void main In most of the Programming language, main... are the variation of main method. public static void main(String[] args) public static void main(String... args) public static void main(String args
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
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
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
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
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
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
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
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
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
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
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
What is the importance of static variable?
What is the importance of static variable?  hi, What is the importance of static variable? thanks
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
This is what i need in this Question - Java Beginners
This is what i need in this Question  You are to choose between two procedures, both of which compute the mini¬mum value in an array of integers. One procedure returns the smallest integer if its array argument is empty
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
Core Java Interview Question Page 8
Core Java Interview Question Page 8       Question: What are the static fields & static... Example Java Code static int counter = 0; A public static field
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
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
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 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
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
java question :)
java question :)  write java program to use vector in ArrayList with add, remove,sort   import java.util.Vector; public class RemoveVectorElement { public static void main(String[] args) { Vector<String>
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
Core Java Interview Question, Interview Question
Why do we need public static void main(String args[]) method in Java... Java Interview Question Page 6 How can i tell what state a thread is in ?     Core Java Interview Question Page 7 What
main() syntax - Java Beginners
roseindia; import java.lang; class Hello{ public static void main(String...main() syntax  Hi, I would like to know the complete structure of the main() in jdk1.5 with sample program. Regards, UsmanAli Shaik,  
problem with main - Java Beginners
; public static final int MOUTH_DEGREES_SHOWN = 180; public void paint...*; public class YellowFace extends JApplet { public static final int FACE_DIAMETER = 200; public static final int X_FACE = 100; public static final
Core Java Interview Question, Interview Question
class tstRunnable { public static void main(String[] args) { myThread my1 = new... Core Java Interview Question Page 5       Question: What are different types
Core Java Interview Question, Interview Question
;     Question: Why do we need public static void main... class did not have a public constructor? Question: What is the difference.... Question: What is reflection in java Answer: Reflection allows Java code
java fundamental question related to string
java fundamental question related to string  public class Myclass { Public static void main(String args[]) { String s=â??helloâ??; StringBuffer sb=new StringBuffer(s); Sb.reverse(); If(s==sb) system.out.println(â??aâ
Core Java Interview Question, Interview Question
;); } } public class tstRunnable { public static void main(String[] args... prints out all thread states. public class ThreadStates{ public static void main...(ts[i]); } } }ADS_TO_REPLACE_8 Question: What methods java providing for Thread
The void keyword
The void keyword       The void is a keyword defined in the java programming language. Keywords... public class Myclass { public void doit
java interview question
java interview question  class Test { void meth1() { System.out.println("meth1()"); meth2(); } static void meth2() { System.out.println("meth2()"); } public static void main
java interview question
java interview question  class Test { void meth1() { System.out.println("meth1()"); meth2(); } static void meth2() { System.out.println("meth2()"); } public static void main
Core Java Interview Question, Interview Question
Core Java Interview Question Page 19       Question: What is the difference between static... is used to cause paint() to be invoked by the AWT painting thread. Question: What
What do you understand by private, protected and public?
What do you understand by private, protected and public?   Hi, What do you understand by private, protected and public? thanks
What is the first argument of the String array in main() method?
What is the first argument of the String array in main() method?  Hi, What is the first argument of the String array in main() method? Thanks.... This article gives your a very easy java program which illustrates about the string
How to Use Java Functions In EL
need three things. The java class with a static method. A Tag Library.... The java class: In this class the functions declared must be public and static. It should have a non- void type return type. After all, its all the matter
What are the restriction imposed on a static method or a static block of code?
What are the restriction imposed on a static method or a static block of code?  hi, What are the restriction imposed on a static method or a static block of code? Thanks
What is the difference between a static and a non-static inner class?
What is the difference between a static and a non-static inner class?   Hi, What is the difference between a static and a non-static inner class? Thanks
JAVA Compile Question ?
java.io.IOException; public class FileStatistics2 { public static void main(String[] args...JAVA Compile Question ?  I'm unable to compile this file and not sure why? Can someone please help? import java.nio.file.*; import

Ads