Answered Questions

  • if there are more than one main method in a program, then which main method will be called.

    what will be the output class A { public static void main(String args[]) { System.out.println("Hi friend"); } } class Test { public static void main(String args[]) { System.out.println(" How are you"); } }

    Manas Naik

    • Jul 7th, 2012

    When we compile it create two different class with name a.class and test.class .so,according to your call it will execute.
    Example--java test
    then output is "how are you" only not hi friend

    Rashmi Ahuja

    • Jun 16th, 2012

    When we execute this class with class B then it first call to class A method main which is like normal method. after that B class print msg is printed