Wednesday 6 May 2015

JAVA: What if the main() method is declared as private or no main() in a class ?


private static void main(String[] args){
}

The above program compiles properly but at run-time it will give error
Error: Main method not found in class Test , please define the main method as:public static void main(String[] args)


package in.blogspot.java2bigdata;
public class NoMain(){
// empty class
}
}

The program compiles properly but at run-time it will give error.
Error: Main method not found in class in.blogspot.java2bigdata.Nomain, please define the main method as:public static void main(String[] args)

 public static void main (String args[]) Explanation


No comments:

Post a Comment