How to call main() from a class (not containing the main function) in a java program?
By in OOP/OOD on Sep 10 2007
  • joy fortune
    Sep, 2007 29

    Just like any other method (static) call you can call main method... I am sending a small code example which may be helpful PS : NOT COMPILED AND NOT TESTED... for example... class ClassContainingMainMethod { public static void main(String ax[]) { // your code ... } } class YourClass { public void yourMethod() { // your code ... String[] ax = new String[1]; ClassContainingMainMethod.main(ax); } }

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS