We Exist to Provide 100% Free Source Code and Tutorials

Custom Search

Main Method Overriding in Java

Many of the folks who are new to Java thinks that compiler will throw error if we are going to override main method in java. But, we can override main method in Java. But we can’t change the method signature.

Here is an example:

  1. class A{
  2. public static void main(String ar[]){
  3. System.out.println("Main A");
  4. }
  5. }
  6. class B{
  7. public static void main(String ar[]){
  8. System.out.println("Main B");
  9. }
  10. }
Facebook Comments
(Visited 1 times, 1 visits today)
Share this

Check Your Domain Ranking

Leave a Reply

Your email address will not be published. Required fields are marked * © 2016 Frontier Theme

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!

%d bloggers like this: