

{"id":7412,"date":"2018-02-07T10:07:00","date_gmt":"2018-02-07T10:07:00","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=7412"},"modified":"2026-05-18T16:19:54","modified_gmt":"2026-05-18T10:49:54","slug":"method-overriding-in-java","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/method-overriding-in-java\/","title":{"rendered":"Method Overriding in Java with Rules and Real-time Examples"},"content":{"rendered":"<p>Before we dive into the topic Method Overriding in Java extensively, let us look at a real-life example as always. Consider a family of three people, the father, the mother, and the son. The father decides to teach his son how to shoot. So he takes him to the range with his favorite rifle and trains him to aim at targets and shoot. However, the father is right-handed but the son is left-handed. So they have different methods of holding the gun! The father was worried that he might not be able to teach his son the art of shooting because of different orientations.<\/p>\n<p>The son, however, was smart and decided to mimic the father\u2019s hands by inverting them, i.e placing his dominant hand on the trigger rather than the father\u2019s dominant hand. i.e the right hand. In this way, by slightly altering the method of learning, the son mastered the art of shooting!<\/p>\n<p>This concept in programming is known as method overriding. Let us learn more about it.<\/p>\n<h3>Method Overriding in Java<\/h3>\n<p>The concept of method overriding is simply the redefinition of the parent class method in the child class. The name of the method remains the same. However, the implementation of the same changes. Similar to the example above, the child class inherits all methods from the parent class Father.<\/p>\n<p>However, the method shoot() gets redefined. That way, the implementation of the method changes but the name still remains the same. This enables easier debugging and cleaner code.<\/p>\n<p><em><strong>If the subclass provides a specific definition of a parent class method, then this action is Method Overloading.<\/strong><\/em><\/p>\n<h3>Advantages of Method Overriding in Java<\/h3>\n<p>The primary advantage of method overriding is that the child class can have a different implementation of a parent class method without even changing the definition of the parent class method.<\/p>\n<p><strong>How is this useful?<\/strong><\/p>\n<p>For example, if a parent class has multiple child classes, each child class can have its own implementation of the parent class method.<br \/>\nHowever, when a parent class reference points to a child class object, the compiler resolves the object call during runtime. This is a dynamic method dispatch.<\/p>\n<p><strong>Program to illustrate Java Method Overriding:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.dataflair.javamethodoverriding;\r\nclass Father {\r\n  void shoot() {\r\n    System.out.println(\"I am the father! I am a right-handed shooter! \");\r\n  }\r\n}\r\npublic class Child extends Father {\r\n  void shoot() {\r\n    System.out.println(\"I am the son! I am a left-handed shooter!\");\r\n  }\r\n  public static void main(String[] args) {\r\n    Father f = new Father();\r\n    f.shoot(); \/\/Here the parent class method gets called.\r\n    Father fc = new Child();\r\n    fc.shoot(); \/\/This is dynamic methpod dispatch. The compiler decides method call at runtime. \r\n  }\r\n}<\/pre>\n<p>Output:<\/p>\n<div class=\"code-output\">I am the father! I am a right-handed shooter!<br \/>\nI am the son! I am a left-handed shooter!<\/div>\n<p><em><strong>Note that the dynamic method dispatch executes the child class method.<\/strong><\/em><\/p>\n<p>In Java, you can also override methods while using multiple inheritance. The method in the parent class can be overridden in all of its successive child classes.<\/p>\n<p><strong>Program to illustrate the use of method overriding in multilevel inheritance in Java:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.dataflair.javamethodoverriding;\r\nclass GrandFather {\r\n  void move() {\r\n    System.out.println(\"I use my stick to move!\");\r\n  }\r\n}\r\nclass Father extends GrandFather {\r\n  void move() {\r\n    System.out.println(\"I can walk fast!\");\r\n  }\r\n}\r\nclass Baby extends Father {\r\n  void move() {\r\n    System.out.println(\"I crawl and have fun!\");\r\n  }\r\n  public static void main(String[] args) {\r\n    GrandFather ob = new Baby();\r\n    ob.move();\r\n\r\n  }\r\n}<\/pre>\n<p>Output:<\/p>\n<div class=\"code-output\">I crawl and have fun!<\/div>\n<h3>When should you use Java method overriding?<\/h3>\n<p>Learning about the intricacies of method overriding and its actual implementation is crucial to developing good software. This prevents code redundancy and results in easy debugging because of good structure.<\/p>\n<p>You should use method overriding when there is a need to implement a specific functionality of a child class that is unique to the class itself. But you might think, \u201cWhy not put it in a separate function altogether?\u201d Well, you are not the first one to think like that. But the same method can have different implementations in different classes, too!<\/p>\n<p>Note the example above. You may realize that we could easily have made a different method for the class Child named \u201cshoot child()\u201d and written class-specific code there! But what we managed to do was keep the same name of the function as the parent class itself! That way, when you try to debug the code, and you realize that there is an error in the shoot() function, you can straightaway go to the class Child and debug your code inside the function. Having different names is tedious and difficult to maintain.<\/p>\n<h3>Method Overriding in Inheritance Hierarchies<\/h3>\n<p>Method overriding becomes even more interesting in scenarios with multiple inheritance levels. Consider a class hierarchy where Child inherits from Parent, and GrandChild inherits from Child. In this case:<\/p>\n<ul>\n<li>GrandChild can override methods inherited from both Parent and Child.<\/li>\n<li>The overriding method in GrandChild will be invoked at runtime if a GrandChild object is referenced by a Parent class variable.<\/li>\n<\/ul>\n<p>This cascaded overriding mechanism provides flexibility in inheritance hierarchies, allowing for specialized behavior in descendant classes.<\/p>\n<h3>Usage of Method Overriding in Java<\/h3>\n<p><strong>The overriding has the following uses in Java:<\/strong><\/p>\n<ul>\n<li>It provides a specific implementation of a predefined method.<\/li>\n<li>Implements runtime polymorphism.<\/li>\n<li>It helps in achieving the runtime polymorphism. Method overriding achieves runtime polymorphism by deciding which method to execute at runtime.<\/li>\n<li>By using method overriding, we can redefine the method in a subclass without affecting the method in the parent class.<\/li>\n<li>It provides adaptability to programs by executing methods according to the calling of an object.<\/li>\n<\/ul>\n<h3>Rules to follow while implementing Java Method Overriding<\/h3>\n<p>There are a few rules when it comes to implementing Method Overriding:<\/p>\n<ul>\n<li>The method should have the same name as the parent class method that is being overridden.<\/li>\n<li>All the parameters\/arguments of the method should match. Remember, this is no method overloading. These two are completely different concepts. For example, if the parent class method has two integer arguments, then the child class method should also accept two integer arguments.<\/li>\n<li>The overriding method access specifier cannot be more restrictive than the parent class access specifier. For example, if the parent method is public, then the child class cannot be default, private, or protected, because all of these access specifiers are more restrictive in nature than public. We will explain this later in this article.<\/li>\n<li>static, final, and private access restrict the method from overriding. This means that any parent class method that has a private access specifier or is static or final in nature cannot be overridden by any of its child classes.<\/li>\n<li>We also cannot override the main method in Java.<\/li>\n<li>If the class is implementing another class that is abstract or implementing an interface, then the class has to override all of the functions, unless the class is abstract in itself.<\/li>\n<li>The overriding method may have unchecked exceptions because the implementation is different from the method in the parent class. However, there should be no additional checked exceptions other than the exceptions in the parent class method.<\/li>\n<li>The class should follow an \u201cIS-A\u201d relationship, i.e, the classes should implement inheritance.<\/li>\n<\/ul>\n<p>Okay, enough of the theory! Let us dive into some code!<\/p>\n<h3>Method Overriding with Access Specifiers in Java<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.dataflair.javamethodoverriding;\r\nclass Father {\r\n  \/\/ private methods are not overridden \r\n  private void method1() {\r\n    System.out.println(\"From Father method1()\");\r\n  }\r\n\r\n  protected void method2() {\r\n    System.out.println(\"From Father method2()\");\r\n  }\r\n}\r\n\r\nclass Child extends Father {\r\n  \/\/ new method1() method \r\n  \/\/ This method is unique to Child class \r\n  private void method1() {\r\n    System.out.println(\"From Child method1()\");\r\n  }\r\n\r\n  \/\/ overriding method \r\n  \/\/ with greater accessibility \r\n  public void method2() {\r\n    System.out.println(\"From Child method2()\");\r\n  }\r\n}\r\n\r\n\/\/ Driver class \r\nclass Main {\r\n  public static void main(String[] args) {\r\n    Father obj1 = new Father();\r\n    obj1.method2();\r\n    Father obj2 = new Child();\r\n    obj2.method2();\r\n  }\r\n}<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">From Father method2()<br \/>\nFrom Child method2()<\/div>\n<p>The private method in the above example is not printed because it is non-overridable.<\/p>\n<h3>Static methods in Java are non-overridable<\/h3>\n<p>If you override a static method in the parent class with the static method in the child class, then the method in the parent class hides the child class method. Let us see an example. However, if you try to override a static method from a non-static method context, or vice versa, the compiler returns an error.<\/p>\n<p><strong>Java program to illustrate static method overriding:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.dataflair.javamethodoverriding;\r\nclass Father {\r\n  \/\/ private methods are not overridden \r\n  static void method1() {\r\n    System.out.println(\"From static Father method1()\");\r\n  }\r\n\r\n  void method2() {\r\n    System.out.println(\"From Father method2()\");\r\n  }\r\n}\r\n\r\nclass Child extends Father {\r\n  \/\/ new method1() method \r\n  \/\/ This method is unique to Child class \r\n  static void method1() {\r\n    System.out.println(\"From static Child method1()\");\r\n  }\r\n\r\n  \/\/ overriding method \r\n  \/\/ with greater accessibility \r\n  void method2() {\r\n    System.out.println(\"From Child method2()\");\r\n  }\r\n}\r\n\r\n\/\/ Driver class \r\nclass StaticOverride {\r\n  public static void main(String[] args) {\r\n    Father obj1 = new Father();\r\n    obj1.method2();\r\n    Father obj2 = new Child();\r\n    obj2.method1(); \/\/According to dynamic method dispatch this should execute child class method but this executes parent class method. \r\n  }\r\n}<\/pre>\n<p>Output:<\/p>\n<div class=\"code-output\">From Father method2()<br \/>\nFrom static Father method1()<\/div>\n<h3>You cannot override final methods in Java<\/h3>\n<p>If you have a method declared as final in your parent class, then that method is non-overridable. Let us see for ourselves.<\/p>\n<p><strong>Program to illustrate Java final method:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.dataflair.javamethodoverriding;\r\nclass Father {\r\n  final void shoot() {\r\n    System.out.println(\"I am the father! I am a right handed shooter! \");\r\n  }\r\n}\r\npublic class Child extends Father {\r\n  void shoot() {\r\n    super.shoot();\r\n    System.out.println(\"I am the son! I am a left handed shooter!\");\r\n  }\r\n  public static void main(String[] args) {\r\n\r\n    Father fc = new Child();\r\n    fc.shoot(); \/\/This is the method which houses the super keyword for calling the parent class method. \r\n  }\r\n}<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">Child.java:10: error: shoot() in Child cannot override shoot() in Father<br \/>\nvoid shoot()<br \/>\n^<br \/>\noverridden method is final<br \/>\n1 error<\/div>\n<h3>Exception Handling and Method Overriding in Java<\/h3>\n<p>There are certain rules when it comes to using exception handling and method overriding. One of them is that if the superclass method does not throw any checked exceptions, then the subclass method can only throw unchecked exceptions. If it tries to throw checked exceptions, then the compiler returns an error.<\/p>\n<p>Let us see with an example of handling exceptions and method overriding in Java:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.dataflair.javamethodoverriding;\r\nclass Parent {\r\n  void methodname() {\r\n    System.out.println(\"I do not have any checked excpetions.\");\r\n  }\r\n}\r\nclass Child extends Parent {\r\n  void methodname() throws IOException {\r\n    System.out.println(\"I throw checked exceptions\");\r\n  }\r\n}\r\npublic class MainException {\r\n  public static void main(String[] args) {\r\n\r\n    Parent p = new Child();\r\n    p.methodname();\r\n  }\r\n\r\n}<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">MainException.java:10: error: methodname() in Child cannot override methodname() in Parent<br \/>\nvoid methodname()throws IOException<br \/>\n^The<br \/>\noverridden method does not throw IOException<br \/>\n2 errors<\/div>\n<p><strong>Points to Remember while using Method Overriding in Java<\/strong><\/p>\n<p>If the parent class method throws a checked exception, then the child class method may or may not throw an exception at all. But if it does throw an exception, it must be the same exception or its subclass. However, if the parent exception is Exception Hierarchy, then a compile error occurs. Let us understand with an example:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.dataflair.javamethodoverriding;\r\nimport java.io. * ;\r\nclass Parent {\r\n  void methodname() throws IOException {\r\n    System.out.println(\"I do not have any checked excpetions.\");\r\n  }\r\n}\r\nclass Child1 extends Parent {\r\n  void methodname() throws IOException {\r\n    System.out.println(\"I throw checked exceptions\");\r\n  }\r\n}\r\nclass Child2 extends Parent {\r\n  void methodname() throws Exception {\r\n    System.out.println(\"Exception Hierarchy\");\r\n  }\r\n}\r\npublic class MainException {\r\n  public static void main(String[] args) {\r\n\r\n    Parent p = new Child1();\r\n    p.methodname();\r\n    Parent p1 = new Child2();\r\n    p1.methodname();\r\n  }\r\n\r\n}<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">MainException.java:18: error: methodname() in Child2 cannot override methodname() in Parent<br \/>\nvoid methodname()throws Exception{<br \/>\n^The<br \/>\noverridden method does not throw an exception<br \/>\n1 error<\/div>\n<h3>Super Keyword in Java<\/h3>\n<p>The super keyword is essential as it calls the parent constructor or a parent class method in the child class. In order to call the parent class constructor, we use <strong>super(),<\/strong> and for calling a superclass method named <strong>supermethod(),<\/strong> the syntax is<strong> super.supermethod(); <\/strong>Let us take a look at one example:<\/p>\n<p><strong>Java program to illustrate the use of super keyword:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.dataflair.javamethodoverriding;\r\nclass Father {\r\n  void shoot() {\r\n    System.out.println(\"I am the father! I am a right-handed shooter! \");\r\n  }\r\n}\r\npublic class Child extends Father {\r\n  void shoot() {\r\n    super.shoot(); \/\/This super keyword calls the method with the same name in the parent class. \r\n    System.out.println(\"I am the son! I am a left-handed shooter!\");\r\n  }\r\n  public static void main(String[] args) {\r\n\r\n    Father fc = new Child();\r\n    fc.shoot(); \/\/This is the method which houses the super keyword for calling the parent class method. \r\n  }\r\n}<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">I am the father! I am a right-handed shooter!<br \/>\nI am the son! I am a left-handed shooter!<\/div>\n<h3>Summary<\/h3>\n<p>Finally, in this article, we learned about the various types of method overriding and its uses in Java. Method overriding implements polymorphism in the language, which is essential to master. We also learned about the super keyword and the rules of method overriding.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Before we dive into the topic Method Overriding in Java extensively, let us look at a real-life example as always. Consider a family of three people, the father, the mother, and the son. The&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":84357,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[20915,7607,7627,20913,20914],"class_list":["post-7412","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","tag-java-method-overriding-tutorial","tag-java-multilevel-method-overriding","tag-java-overridden-methods","tag-method-overriding-in-java-with-example","tag-method-overriding-rules-in-java"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Method Overriding in Java with Rules and Real-time Examples - DataFlair<\/title>\n<meta name=\"description\" content=\"Learn &amp; implement the rules for Method Overriding in Java and explore the concept of Multilevel Method Overriding with real-time example\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/method-overriding-in-java\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Method Overriding in Java with Rules and Real-time Examples - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Learn &amp; implement the rules for Method Overriding in Java and explore the concept of Multilevel Method Overriding with real-time example\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/method-overriding-in-java\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-02-07T10:07:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-05-18T10:49:54+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Method-Overriding-in-Java-df.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Method Overriding in Java with Rules and Real-time Examples - DataFlair","description":"Learn & implement the rules for Method Overriding in Java and explore the concept of Multilevel Method Overriding with real-time example","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/method-overriding-in-java\/","og_locale":"en_US","og_type":"article","og_title":"Method Overriding in Java with Rules and Real-time Examples - DataFlair","og_description":"Learn & implement the rules for Method Overriding in Java and explore the concept of Multilevel Method Overriding with real-time example","og_url":"https:\/\/data-flair.training\/blogs\/method-overriding-in-java\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-02-07T10:07:00+00:00","article_modified_time":"2026-05-18T10:49:54+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Method-Overriding-in-Java-df.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/method-overriding-in-java\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/method-overriding-in-java\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823"},"headline":"Method Overriding in Java with Rules and Real-time Examples","datePublished":"2018-02-07T10:07:00+00:00","dateModified":"2026-05-18T10:49:54+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/method-overriding-in-java\/"},"wordCount":1555,"commentCount":2,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/method-overriding-in-java\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Method-Overriding-in-Java-df.jpg","keywords":["Java Method Overriding Tutorial","Java Multilevel Method Overriding","Java Overridden Methods","Method Overriding in Java with example","Method Overriding rules in Java"],"articleSection":["Java Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/method-overriding-in-java\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/method-overriding-in-java\/","url":"https:\/\/data-flair.training\/blogs\/method-overriding-in-java\/","name":"Method Overriding in Java with Rules and Real-time Examples - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/method-overriding-in-java\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/method-overriding-in-java\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Method-Overriding-in-Java-df.jpg","datePublished":"2018-02-07T10:07:00+00:00","dateModified":"2026-05-18T10:49:54+00:00","description":"Learn & implement the rules for Method Overriding in Java and explore the concept of Multilevel Method Overriding with real-time example","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/method-overriding-in-java\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/method-overriding-in-java\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/method-overriding-in-java\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Method-Overriding-in-Java-df.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Method-Overriding-in-Java-df.jpg","width":1200,"height":628,"caption":"Method Overriding in Java"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/method-overriding-in-java\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Java Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/java\/"},{"@type":"ListItem","position":3,"name":"Method Overriding in Java with Rules and Real-time Examples"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team creates expert-level guides on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our goal is to empower learners with easy-to-understand content. Explore our resources for career growth and practical learning.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/7412","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=7412"}],"version-history":[{"count":18,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/7412\/revisions"}],"predecessor-version":[{"id":148350,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/7412\/revisions\/148350"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/84357"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=7412"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=7412"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=7412"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}