Search unanswered questions...
Enter a question here...

Is it possible to override the main method in Java?

In: JAVA
[Edit]

Answer

static method can be overide.it is should be possible. example

class madd

{

public static void main(String args[])

{

}

}

public class mohit extends madd

{

public static void main(String args[])

{

System.out.println("HELLO");

}

}

compile succefully and run also.then output will be HELLO

Improve Answer Discuss the question "Is it possible to override the main method in Java?" Watch Question

First answer by ID408319499. Last edit by Mohit kaushik. Contributor trust: 0 [recommend contributor]. Question popularity: 25 [recommend question]

Research your answer:

Answers.com > Wiki Answers > Categories > Technology > Computers > Computer Programming > JAVA > Is it possible to override the main method in Java?

Our contributors said this page should be displayed for the questions below. (Where do these come from)
If any of these are not a genuine rephrasing of the question, please help out and edit these alternates.
Two main functions in java?  Can you override main method?  What does main method do in java?  Can you override a static method?  Can you have two main functions in java?  Diff bw suspand and wait method in java?  How can you override the method in java?  Can main function in java be overridden?  Main method can be overloaded or override?  An example of overriding a main method in java?