Yes it is possible to have two main() in the same program. For instance, if I have a class Demo1 as below. ... Yes, you can have as many main methods as you like. You can have main methods with different signatures from main(String[]) which is called overloading, and the JVM will ignore those main methods.Nov 15, 2012class Sum {int add(int a, int b) {return (a+b); }public static void main (String args[]) {System.out.println(" using Sum class");Sum a = new Sum();System.out.println("Sum is :" + a.add(5, 10));}public static void main (int i) {System.out.println(" Using Sum class main function with integer argument");Sum a = new Sum();System.out.println("Sum is :" + a.add(20, 10));} }class DefClass {public static void main (String args[]) {System.out.println(" using DefClass");Sum a = new Sum();System.out.println("Sum is :" + a.add(5, 10));Sum.main(null);Sum.main(1);} }