Home Answers Viewqa Java-Beginners Java Question What is Public, Static, void and main

 
 


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

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 Pages:
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
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
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
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
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
static
StaticClass1 { public static void main(String[] args){ StaticClass1 sv1... static variable in the inherited class like this: public class StaticClass1...); **//here i have redeclared the static variable as "25" is it possible,then what
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
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
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
static
static  what r the main uses of static in java   Hi Friend, The Static means that a certain object/variable is resident in memory... the following link: http://www.roseindia.net/help/java/s/static-java-keyword.shtml
question
; /** * @param args */ public static void main(String[] args) { // TODO Auto-generated...); searchButton.addActionListener(this); } @Override public void actionPerformed(ActionEvent ae... search and send using java swing .If i am clicking a search button then i want
static
is why if you declare the function main as static then java does not have...Static Concept  in what are all the situation we may use static...,then use static blocks and without creation of object we need to perform some task
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 & 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
Question
in connection database with the java code. import java.sql.*; public class MysqlConnect{ public static void main(String[] args) { System.out.println("MySQL
question
extends JFrame{ public static void main(String[]args){ JFrame...() { public void actionPerformed(ActionEvent e... search using java swing .If i am clicking a search button then i want
question
(){ return marks; } public static void main(String[] args){ int count... getAverage(){ return average; } } class StudentEx { public static void... ( to find out result from the given Java code ) Core Java interview questions
question
javax.swing.text.MutableAttributeSet; public class Original { public static void main(String[] args...() { public void windowClosing(WindowEvent e..."); loadButton.addActionListener(new ActionListener() { public void
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
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
Many Public Classes in One File - Java Tutorials
AllTest2 { public static void main(String[] args) { A a = new A(); B b... A { public void f() {} } public static class B { public void g() {} } public static class C { public void h() {} } public
static functions
(){ System.out.println("it is static methode"+a); } } class main{ public static void...{ public static void main(string args[]){ a obj=new a();//can ,t requirement..."+a); } } class main{ public static void main(string args[]){ a obj=new a();//can ,t
I'm getting an illgal start of expression error in my code for the public static boolean portion at the bottom... any ideas?
{ public static void main (String[] args) { Random rand = new Random... { public static void main (String[] args) { Random rand = new Random...; } } } } public static boolean playAgain
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
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
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
static
static  What is the exact need of declaring a variable as static?   A static variable is a variable who's single copy in memory is shared by all objects,so any modifications to the static variable will modify it's value
Question?
static void main(String[] arguments) { JLottery2 lotFrame = new JLottery2... static void main(String[] arguments) { Scanner input=new Scanner(System.in...); } public void itemStateChanged(ItemEvent check) { Object source
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
main function
main function  Give me the description of public static void main(Strings args
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
The void keyword
; The void is a keyword defined in the java programming language. Keywords... is the syntax that displays how to use the keyword voidpublic class Myclass { public void doit() { <
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>
Exception in thread "main" java.lang.ClassCastException
){e.printStackTrace();} } } public static void main(String[] argv) { try { Class driver... static void test(java.sql.Connection conn) { String query = "select nom_com from...Exception in thread "main" java.lang.ClassCastException  I am trying
Exception in thread "main" java.lang.ClassCastException
){e.printStackTrace();} } } public static void main(String[] argv) { try { Class driver... public static void test(java.sql.Connection conn) { String query = "select nom_com...Exception in thread "main" java.lang.ClassCastException  I am trying
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
JAVA QUESTION - Java Beginners
public class ConstructorOverloading{ public static void main(String args...); } } class mainClass extends methodOverloading { public static void main... static void main( String arr[] ) { String showMessage() { System.out.println
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
static Java Keyword
of the use of the " public static void main method()" in most of the console... getObjects(){ } public static void main method(String av... static Java Keyword      
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
java question
es; } public static void main(String[] args ) throws IOException... java.io.*; public class Employeelookup { static ArrayList<Employeelookup> al...++; } public void putDetails(Employeelookup e) { al.add(e); } public
java question
es; } public static void main(String[] args ) throws IOException... java.io.*; public class Employeelookup { static ArrayList<Employeelookup> al...++; } public void putDetails(Employeelookup e) { al.add(e); } public
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
static keyword in java
); } } public class Test{ public static void main(String args... .style1 { color: #0000FF; } static keyword in java We are going to discuss about static keyword in java. The static keyword is a special
about static import - Java Beginners
*; class B { public static void main(String ar[]) { System.out.println(i... is not static. Use public modifier instead of protected modifier in Class...: package mypack; public class TestA { public static int i=100; } 2