Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Java
package com.contruct;

class Example{
	   //I did not define any constructor here
	   public void disp()
	   {
	      System.out.println("disp method of Example class");
	   }
//	   public static void main(String args[]){
	      Example obj2 = new Example();
//	      obj2.disp();
	   
	}
Error is
Error: Main method not found in class com.contruct.Example, please define the main method as:
public static void main(String[] args)
or a JavaFX application class must extend javafx.application.Application

I understant ,if i remove comment ,code will run fine ,but I want to understand the logic ,Why Its Showing compilation Error
Posted
Updated 12-Mar-15 6:04am
v2

1 solution

The main method is the start point of any java program. Read more: What is main method in Java ?[^]
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 12-Mar-15 12:05pm    
5ed.
—SA
Peter Leow 12-Mar-15 12:05pm    
Thank you, Sergey.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900