Home Tutorialhelp Comment why public before main

 
 

Comment

lakkaraju mohan krishna
why public before main,
December 21, 2009 at 12:05 PM

as main is not called by any other object.then why to use public before main
View All Comments | View Tutorial
Advertisement
Related Tutorial and Articles
Java Beginners

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 Beginners

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 Beginners

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 

General

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 

Java Interview Questions

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... void main(String a[]) method,we execute method without main method(by static block) why need of public static void main(String [])?   Static blocks 

Java-Tutorials

What is Public static void main
in java using main method. class Helloworld { public static void main(String...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 

Java Beginners

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 

Java Beginners

What happen when we write static public void instead of public static void?
/gettingstartedwithjava/public-static-void-main.shtml   Hi...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 

Java Beginners

Why we should use string args[] in main method in java?
each and every meaning of public static void main(String args[])...   import javax.swing.JOptionPane; public class a3c4e23 { public static void main...Why we should use string args[] in main method in java?  we use only 

Java Interview Questions

Display Hello even before main get executed??
is how? **class Hello{ public static void main(String[] args...("Hello, Thank You"); } public static void main(String[] args..."); } public static void main(String[] args){ display(); System.out.print 

Java Beginners

main function
main function  Give me the description of public static void main(Strings args 

Java Beginners

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 

Java Beginners

main method
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 is a class method. void- It indicates that the main() method has no return value 

Java Beginners

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,   

Java Beginners

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 

JDBC Questions

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 

Java Beginners

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 

Java Beginners

Accessing non-static members through the main method in Java.
Accessing non-static members through the main method in Java.  ... in Java has access to non-static members (variables or methods) even though it is permanently public static void 

Java Beginners

main function defnition in class - Java Beginners
static void main(String[] args) Thanks  hi, we use public...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 

Java Beginners

main method
main method  Why is the java main method static 

Java Interview Questions

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 

General

Main Thread and Child Thread
()); } } public static void main(String[] args) { mainchild mch = new mainchild... There are two types of threads in Java Progarm In Java there are Main... when program runs. Child Thread gets created by the main thread . Java Main 

Development process Questions

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 

Development process Questions

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 

Java Beginners

STATIC
is an example: public class StaticTest { static{ System.out.println("Hello from static block"); } public static void helloMethod() { System.out.println("Hello from static method"); } public static void main(String[] args) { helloMethod 

Java Beginners

how to solve the nullPointer Exception in main - Java Beginners
; } public static void main(String args[]){ split s = new split (); actualState1 ac...*; public class split { public String[] spaceWord = null; public static void... me how fix Null pointer Exception in main: two files , split .java another 

Java Beginners

static
StaticClass1 { public static void main(String[] args){ StaticClass1 sv1...redeclare static variable in the inherited class  can we redeclare static variable in the inherited class like this: public class StaticClass1 

Java Beginners

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 Beginners

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 

Java Beginners

java main program
java main program  how to write a main program for the following code public class JaroWinkler { private String compOne; private... = ""; private int mRange = -1; public JaroWinkler 

Java Beginners

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 

Java Interview Questions

create main page
create main page  <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@page import...;%@page import="javax.servlet.*"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 

Java Beginners

exception in thread main java.lang.unsupportedclassversionerror unsupported major.minor version 50.0 - Java Beginners
java.lang.unsupportedclassversionerror unsupported major.minor version 50.0 class xxx { public static void...!"); } } for example: javac xxx.java-->comping java xxxx:error :exception in thread main...exception in thread main java.lang.unsupportedclassversionerror unsupported 

Java Beginners

exception in thread main java.lang.unsupportedclassversionerror unsupported major.minor version 50.0 - Java Beginners
. Thanks  my code is class xxx { public static void main(String...exception in thread main java.lang.unsupportedclassversionerror unsupported.... java -version java version "1.4.2_06" javac -version java version 

Java Beginners

how to return to main menu after adding all the info. - Java Beginners
how to return to main menu after adding all the info.  import java.util.Scanner; public class RegistrationSystem { public static void main... RegistrationSystem { public static void main(String[] args) throws Exception 

Java Interview Questions

How I call the function union from the main - Java Interview Questions
; } public static void main(String[] args) { Relation relation = new...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 

Java Beginners

could not find the main class programm will exit - error
); System.out.println("Number of the Car is: " + num); } public static void main...); } public static void main (String ars[]){ Car c = new Car... static void main (String ars[]){ Car c = new Car(); c.accept 

Java Beginners

Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method  Hi there i am a java..."); totalButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed...(new java.awt.event.ActionListener() { public void actionPerformed 

Java Beginners

Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method  Hi there i am a java..."); totalButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed...(new java.awt.event.ActionListener() { public void actionPerformed 

Java Beginners

Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method  Hi there i am a java..."); totalButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed...(new java.awt.event.ActionListener() { public void actionPerformed 

Java Beginners

Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method  Hi there i am a java..."); totalButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed...(new java.awt.event.ActionListener() { public void actionPerformed 

Java Beginners

Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method  Hi there i am a java..."); totalButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed...(new java.awt.event.ActionListener() { public void actionPerformed 

Java Beginners

Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method  Hi there i am a java..."); totalButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed...(new java.awt.event.ActionListener() { public void actionPerformed 

Swing AWT

how to open one Jframe from main method call
public static void main(String[] args) { new PlayGame().setVisible(true...how to open one Jframe from main method call  I have downloaded a snake game project in java. Initially the project contains three java files i.e 

Java Beginners

Can a main method be declared final?
be declare as follows: public final String convertCurrency() The final method can't be override in a subclass. for more about main method be declared final in Java...Can a main method be declared final?   Hi, Can a main method 

Java Interview Questions

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 

Java Beginners

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 

Java Beginners

static & instance - Java Beginners
is: " + count); // } public static void main(String[] args... and when can use instance variable.    public class Main { private static int noOfObjects; private int count; public Main 

Java Beginners

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 

Java Interview Questions

why this can't
why this can't  import java.util.*; class Dash{ public static void main(String args[]){ int x0=100; int[] x1=new int[3]; int[][] x2=new int[3][3]; int[][][] x3=new int[3][3][3 

Java Beginners

Why this is not working...?
"); } } } public static void main(String[] args) { Person...Why this is not working...?  import java.util.*; public class Family...]); } } public void printOutFamily(){ for (int i = 0; i < size_of_family 

Core Java

Public Java Keyword
Public Java Keyword       public is a keyword defined in the java programming language. Keywords are basically reserved words which have specific meaning relevant to a compiler in java 

Hibernate Questions

Exception in thread "main" org.hibernate.hql.ast.QuerySyntaxException: TESTING is not mapped [FROM TESTING]
{ @SuppressWarnings("rawtypes") public static void main (String args...; public class TestDB { public static void main (String args[]) throws...; POJO class: package main; public class Testing { private int id 

Java Beginners

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 

JSP Interview Questions

how to pass variable from simple java main class(not servlet) to the jsp page?
code: public static void openURL(String url) { String osName...how to pass variable from simple java main class(not servlet) to the jsp page?  I have a simple Java class in which I invoke a call to a JSP page 

Core Java

Static variable in java
; } public static void main(String args[]) { salary=10000...Static variable in java. Static is a keyword in java used to create static...; Classname.variablename; Example: Using Static Variable. public class Staticvariable 

Java Interview Questions

why zero? - Java Interview Questions
why zero?  import java.util.Scanner; public class Simple { public static void main(String[] args) { Scanner scanner = new Scanner(System.in... number is" + lowest); } } why the lowest number is zero?.. i know 

Java Beginners

core java, static - Java Beginners
"); } public static void main(String args[]) { Static st1 = new Static.... //Static.java public class Static { static void stat() { Static st1...core java, static  Dear sir, in java non-static fields can 

Java Beginners

Class and interface in same file and accessing the class from a main class in different package
class CheckAnimals { public static void main(String[] args) { Animal... flyingType.fly(); } public void setFlyingAbility(Fly newFlyType...(); flyingType = new CantFly(); } public void digHole 

Java Beginners

Class and interface in same file and accessing the class from a main class in different package
class CheckAnimals { public static void main(String[] args) { Animal... flyingType.fly(); } public void setFlyingAbility(Fly newFlyType...(); flyingType = new CantFly(); } public void digHole 

Java Beginners

MAin error
MAin error  Error while running hello program in another dir rather in bin. path is already set. java -version jdk1.6.0_24 no error while compilation but @ d tym of runnin error in main class is generated Exception in thread 

Java Beginners

.jar file keeps giving me " could not find the main class". Program will exit.
the command line arguments */ public static void main(String args... is created successfully."); } catch (Exception ex) {} } public static void main... class CreateJar { public static int buffer = 10240; protected void 

Java Beginners

if i run this prog, i got exeption in thread "main" java.lang.ArrayIndexOutOfBoundsException:0 at Maxof2.main(Maxof2.java:9), whats the resolution for ths?
?  class Maxof2{ public static void main(String args[]){ //taking...{ public static void main(String args[]){ Scanner input=new Scanner(System.in...if i run this prog, i got exeption in thread "main 

Java Beginners

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 

Java Beginners

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 

General

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

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() { < 

General Information

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 

Java Beginners

why it is throwing classCastException.
why it is throwing classCastException.   public class Redwood extends Tree { public static void main(String[] args) { new Redwood().go(); } void go() { go2(new Tree(), new Redwood()); go2((Redwood) new 

General

SCJP Module-1 Question-22
Given a sample code: public class Test { public static final String COOL = "boy"; public static void main(String[] args) { Sub a = new Sub... { public static final String COOL = "girl"; } What will be the result 

Java Beginners

why cant i close this ??
why cant i close this ??  import java.util.Scanner; public class square { public static void main ( String [] args) { Scanner keyboard = new Scanner (System.in); int N; N = keyboard.nextInt 

General

Adding slash "\" character before quote "'" in a query
) == '\'') s.insert (i++, '\\'); return s.toString(); } public static void... in your java application to add the slashes. public String addSlashes... Adding slash "\" character before quote "'" 

Java Interview Questions

static code problem - Java Interview Questions
class AB { public static void main(String args[]) { method(); method(8); } public static void method() { System.out.println("Hello"); } public static void method(int i) { System.out.println(i); } } Thanks 

Java Beginners

why my keyevent not function ? - java swing -
jbtDivide; // main method to instantiate and customize frame public static void main(String[] args) { Calculator frame = new Calculator...why my keyevent not function ? - java swing -   import java.awt. 

Java Beginners

why my keyevent not function ? - java swing -
jbtDivide; // main method to instantiate and customize frame public static void main(String[] args) { Calculator frame = new Calculator...why my keyevent not function ? - java swing -   import java.awt. 

Management

Careers in Advertising and Public Relations
Advertising and public relations are the important and major tools... today is depend upon the glamour of advertisement and public relations and no one..., even advertising and public relation have been playing a crucial role in building 

Java Beginners

Multi Threading is not working in that why...?
byte[] dataBytes2 = new byte[100000000]; public static void main(String...(); // Start the thread } @SuppressWarnings("static-access") public void run...Multi Threading is not working in that why...?   import java.io.File 

Core Java

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 

Java Beginners

Why the null Pointer exception is comming? - Java Beginners
java.lang.reflect.Array; public class replaceTool { public static void main... java.util.regex.Pattern; public class ReplaceTool{ public static void main(String...Why the null Pointer exception is comming?  My code is given below 

JDBC Questions

java [ cannot retrive date from sql ] why??
static void main(String []sd)throws Exception{ count ob=new count(); ob.date_mdt...java [ cannot retrive date from sql ] why??   import..._date, d,m,y; public void date_mdt()throws ParseException{ String date 

Java Beginners

STACK - WHY THE OUTPUT COMES LIKE THIS?
STACK - WHY THE OUTPUT COMES LIKE THIS?  //: holding/StackTest.java import net.mindview.util.*; public class StackTest { public static void main... has dog My WHY THE OUTPUT COMES LIKE 

Java Interview Questions

why the occupancy rate is zero? - Java Interview Questions
why the occupancy rate is zero?  import java.util.Scanner; public class lab3 { public static void main(String[]args) { int floor; int...); } } why the occupancy rate is always zero? please help. tq.  Hello 

Web Development

Public Relations and Social Media
Public Relations and Social Media Arrival of new things has often... the popular ways of communication and when it comes to the public relations social... sites to make their campaigns successful. The relations between public relation 

Java Beginners

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 

Java Beginners

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 

Java Beginners

Why does this code prints fAfA instead of fBfA ?
Why does this code prints fAfA instead of fBfA ?  class B { void f(){ System.out.print("fB");} B(){f(); } } public class A extends B{ void f(){ System.out.print("fA");} A(){ f();} public static void main 

Hibernate Interview Questions

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 

Java Beginners

why java does not support multiple inheritance - Java Beginners
{ public static void main(String ar[]) { new A4().show1(); new A4...why java does not support multiple inheritance  hello friend, i knows that multiple inheritance is not supported in JAVA but this program looks ok 

Java Beginners

non static variable cannot be referenced from static context
public static void main(String []s){ Add a1=new Add(); a1.add(7,8...non static variable cannot be referenced from static context  public class Add{ int foo=7; int bar=8; public int add(int x,int y 

Java Beginners

non static variable cannot be referenced from static context
public static void main(String []s){ Add a1=new Add(); a1.add(7,8...non static variable cannot be referenced from static context  public class Add{ int foo=7; int bar=8; public int add(int x,int y 

Java Beginners

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 

Java Beginners

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 

Java Beginners

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 

Java Interview Questions

public String getResult
public String getResult  String temp=""; for (int i=0,j=1; i<j; i++,j++){ if ((x[i].indexOf((d))!=-1){ temp+=x[i]; temp+=":"; } { return temp; } what is the output when d= "life" and x={"life 

Java Beginners

arrays,why we cannot use this statement
arrays,why we cannot use this statement  import java.util.*; class Dash{ public static void main(String args[]){ int x0=100; int[] x1=new int[3]; int[][] x2=new int[3][3]; int[][][] x3 

Java Beginners

arrays,why we cannot use this statement
arrays,why we cannot use this statement  import java.util.*; class Dash{ public static void main(String args[]){ int x0=100; int[] x1=new int[3]; int[][] x2=new int[3][3]; int[][][] x3 

Java Beginners

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 

Spring 3

Spting AOP Static Pointcut
org.springframework.aop.support.Pointcuts; public class TestPointCut { public static void main...; public class SimpleBean { public void greetMethod() { System.out.println("Have... .style1 { background-color: #FFFFCC; } Static Pointcut Static 

Java Interview Questions

main method
main method  What is the argument type of a program's main() method 

Java Interview Questions

main() method
main() method  Can we define two main() methods having same parameter but with different return type in a program 

Advertisements Advertisements
 

 

 

DMCA.com