{"id":3393,"date":"2024-11-15T16:14:33","date_gmt":"2024-11-15T16:14:33","guid":{"rendered":"https:\/\/sankhamtech.com\/index.php\/content\/india\/english\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-polymorphism-in-java\/"},"modified":"2024-11-15T16:15:10","modified_gmt":"2024-11-15T16:15:10","slug":"understanding-polymorphism-in-java","status":"publish","type":"page","link":"https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-polymorphism-in-java\/","title":{"rendered":"Understanding Polymorphism in Java"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"3393\" class=\"elementor elementor-3393\">\n\t\t\t\t<div class=\"elementor-element elementor-element-1655870 e-flex e-con-boxed e-con e-parent\" data-id=\"1655870\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t<div class=\"elementor-element elementor-element-3a1b5d6 e-con-full e-flex e-con e-child\" data-id=\"3a1b5d6\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-490096c elementor-hidden-mobile elementor-widget elementor-widget-text-editor\" data-id=\"490096c\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h6 style=\"text-align: center;\"><span style=\"text-decoration: underline;\">Lessons<\/span><\/h6>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c00d0d6 elementor-hidden-desktop elementor-hidden-tablet elementor-widget elementor-widget-text-editor\" data-id=\"c00d0d6\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h6 style=\"text-align: center;\"><a href=\"https:\/\/sankhamtech.com\/index.php\/content\/india\/english\/home\/free-courses\/understanding-object-oriented-programming-in-java\/\"><span style=\"text-decoration: underline;\">Lessons<\/span><\/a><\/h6>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-71089df elementor-hidden-mobile elementor-widget elementor-widget-darsanam_header_menu_widget\" data-id=\"71089df\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"darsanam_header_menu_widget.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"darsanam-menu-wrapper \"><div class='hamburger-icon'><i class=\"fas fa-grip-lines\"><\/i> &nbsp; <\/div><div class=\"menu-container\"><nav class='elementor-menu'><ul class='darsanam-menu-vertical'><li class='darsanam-menu-item'><a href='https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/setting-up-your-development-environment\/'>Setting Up Your Development Environment<\/a><i class=\"menu-icon-right fas fa-angle-right\"><\/i><\/li><li class='darsanam-menu-item'><a href='https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/java-basics-syntax-variables-data-types-and-operators\/'>Java Basics - Syntax, Variables, Data Types, and Operators<\/a><i class=\"menu-icon-right fas fa-angle-right\"><\/i><\/li><li class='darsanam-menu-item'><a href='https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-objects-and-classes-in-java\/'>Understanding Objects and Classes in Java<\/a><i class=\"menu-icon-right fas fa-angle-right\"><\/i><\/li><li class='darsanam-menu-item'><a href='https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-encapsulation-in-java\/'>Understanding Encapsulation in Java<\/a><i class=\"menu-icon-right fas fa-angle-right\"><\/i><\/li><li class='darsanam-menu-item'><a href='https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-inheritance-in-java-the-is-a-relationship\/'>Understanding Inheritance in Java: The \"Is-A\" Relationship<\/a><i class=\"menu-icon-right fas fa-angle-right\"><\/i><\/li><li class='darsanam-menu-item'><a href='https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-constructors-in-java-inheritance\/'>Understanding Constructors in Java Inheritance<\/a><i class=\"menu-icon-right fas fa-angle-right\"><\/i><\/li><li class='darsanam-menu-item'><a href='https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-access-modifiers-in-java-inheritance\/'>Understanding Access Modifiers in Java Inheritance<\/a><i class=\"menu-icon-right fas fa-angle-right\"><\/i><\/li><li class='darsanam-menu-item'><a href='https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-polymorphism-in-java\/' style='color: #FF7700 !important'>Understanding Polymorphism in Java<\/a><i class=\"menu-icon-right fas fa-angle-right\"><\/i><\/li><li class='darsanam-menu-item'><a href='https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-abstract-classes-and-methods-in-java\/'>Understanding Abstract Classes and Methods in Java<\/a><i class=\"menu-icon-right fas fa-angle-right\"><\/i><\/li><li class='darsanam-menu-item'><a href='https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-interfaces-in-java\/'>Understanding Interfaces in Java<\/a><i class=\"menu-icon-right fas fa-angle-right\"><\/i><\/li><li class='darsanam-menu-item'><a href='https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-exception-handling-in-java\/'>Understanding Exception Handling in Java<\/a><i class=\"menu-icon-right fas fa-angle-right\"><\/i><\/li><li class='darsanam-menu-item'><a href='https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/java-collections-framework-list-set-map-and-their-implementations\/'>Java Collections Framework - List, Set, Map, and their implementations<\/a><i class=\"menu-icon-right fas fa-angle-right\"><\/i><\/li><li class='darsanam-menu-item'><a href='https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-loops-in-java-foreach-and-lambda\/'>Understanding Loops in Java: forEach and lambda<\/a><i class=\"menu-icon-right fas fa-angle-right\"><\/i><\/li><li class='darsanam-menu-item'><a href='https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-the-serializable-interface-in-java\/'>Understanding the Serializable Interface in Java<\/a><i class=\"menu-icon-right fas fa-angle-right\"><\/i><\/li><li class='darsanam-menu-item'><a href='https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-java-beans\/'>Understanding Java Beans<\/a><i class=\"menu-icon-right fas fa-angle-right\"><\/i><\/li><li class='darsanam-menu-item'><a href='https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/making-api-calls-in-java-a-comprehensive-guide\/'>Making API Calls in Java: A Comprehensive Guide<\/a><i class=\"menu-icon-right fas fa-angle-right\"><\/i><\/li><\/ul><\/nav><\/div><\/div>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-a301a42 e-con-full e-flex e-con e-child\" data-id=\"a301a42\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-825ab4a elementor-widget elementor-widget-text-editor\" data-id=\"825ab4a\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h2>Understanding Polymorphism in Java<\/h2><p><\/p><p><\/p><h4 class=\"wp-block-heading\"><\/h4><p>Polymorphism in Java allows a single entity, such as a method, to take multiple forms. This is a key aspect of object-oriented programming, enhancing code flexibility and reusability. The two primary forms of polymorphism in Java are method overloading and method overriding.<\/p><h4 class=\"wp-block-heading\"> <\/h4><h4 class=\"wp-block-heading\">Method Overloading (Compile-Time Polymorphism)<\/h4><h4 class=\"wp-block-heading\"> <\/h4><p>Method overloading occurs when two or more methods in the same class have the same name but different parameters (in number, type, or both). This allows a method to perform different functions based on the input parameters. It is resolved at compile-time, hence known as compile-time polymorphism.<\/p><h4 class=\"wp-block-heading\"> <\/h4><h5 class=\"wp-block-heading\">Example of Method Overloading:<\/h5><h4 class=\"wp-block-heading\"> <\/h4><pre class=\"wp-block-code\"><code>public class Calculator {\n\n    \/\/ Method to add two integers\n    public int add(int a, int b) {\n        return a + b;\n    }\n\n    \/\/ Overloaded method to add three integers\n    public int add(int a, int b, int c) {\n        return a + b + c;\n    }\n}\n\npublic class Main {\n    public static void main(String[] args) {\n        Calculator calc = new Calculator();\n        System.out.println(calc.add(10, 20)); \/\/ Calls first add method\n        System.out.println(calc.add(10, 20, 30)); \/\/ Calls overloaded add method\n    }\n}\n<\/code><\/pre><h4 class=\"wp-block-heading\"> <\/h4><p>In this example, the <code>Calculator<\/code> class has two versions of the <code>add<\/code> method: one that adds two integers and another that adds three integers. The compiler determines which method to call based on the number of arguments.<\/p><h4 class=\"wp-block-heading\"> <\/h4><h4 class=\"wp-block-heading\">Method Overriding (Runtime Polymorphism)<\/h4><h4 class=\"wp-block-heading\"> <\/h4><p>Method overriding occurs when a subclass provides a specific implementation for a method that is already defined in its superclass. This allows a subclass to define a behavior specific to it, which is different from the superclass. The method to be executed is determined at runtime based on the object type, which is why it&#8217;s called runtime polymorphism.<\/p><h4 class=\"wp-block-heading\"> <\/h4><h5 class=\"wp-block-heading\">Example of Method Overriding:<\/h5><h4 class=\"wp-block-heading\"> <\/h4><pre class=\"wp-block-code\"><code>public class Animal {\n    public void sound() {\n        System.out.println(\"Animal makes a sound\");\n    }\n}\n\npublic class Dog extends Animal {\n    \n    \/\/ Overriding the sound method\n    @Override\n    public void sound() {\n        System.out.println(\"Dog barks\");\n    }\n}\n\npublic class Main {\n    public static void main(String[] args) {\n        Animal myAnimal = new Dog();\n        myAnimal.sound(); \/\/ Outputs \"Dog barks\"\n    }\n}\n<\/code><\/pre><h4 class=\"wp-block-heading\"> <\/h4><p>In this example, the <code>sound<\/code> method in the <code>Dog<\/code> class overrides the <code>sound<\/code> method defined in the <code>Animal<\/code> superclass. When an object of type <code>Dog<\/code> is treated as an <code>Animal<\/code> and the <code>sound()<\/code> method is invoked, the overridden method in <code>Dog<\/code> is executed, displaying &#8220;Dog barks&#8221;.<\/p><h4 class=\"wp-block-heading\"> <\/h4><h4 class=\"wp-block-heading\">Polymorphism and Inheritance at Work in Java<\/h4><h4 class=\"wp-block-heading\"> <\/h4><h5 class=\"wp-block-heading\">Example: Animals and Their Sounds<\/h5><h4 class=\"wp-block-heading\"> <\/h4><p>Consider a simple example with a superclass <code>Animal<\/code> and its subclasses <code>Dog<\/code> and <code>Cat<\/code>. Each subclass will override a method from <code>Animal<\/code> to exhibit polymorphic behavior.<\/p><h4 class=\"wp-block-heading\"> <\/h4><pre class=\"wp-block-code\"><code>\/\/ Superclass\npublic class Animal {\n    public void makeSound() {\n        System.out.println(\"Animal makes a sound\");\n    }\n}\n\n\/\/ Subclass 1\npublic class Dog extends Animal {\n    @Override\n    public void makeSound() {\n        System.out.println(\"Dog barks\");\n    }\n}\n\n\/\/ Subclass 2\npublic class Cat extends Animal {\n    @Override\n    public void makeSound() {\n        System.out.println(\"Cat meows\");\n    }\n}\n\n\/\/ Main class to demonstrate polymorphism\npublic class Main {\n    public static void main(String[] args) {\n        Animal myAnimal;\n\n        \/\/ Dog instance treated as an Animal\n        myAnimal = new Dog();\n        myAnimal.makeSound(); \/\/ Outputs \"Dog barks\"\n\n        \/\/ Cat instance treated as an Animal\n        myAnimal = new Cat();\n        myAnimal.makeSound(); \/\/ Outputs \"Cat meows\"\n    }\n}\n<\/code><\/pre><h4 class=\"wp-block-heading\"> <\/h4><h3 class=\"wp-block-heading\">Explanation<\/h3><h4 class=\"wp-block-heading\"> <\/h4><ul class=\"wp-block-list\"><li>The <code>Animal<\/code> class has a method <code>makeSound()<\/code>.<\/li> <li>The <code>Dog<\/code> and <code>Cat<\/code> classes extend <code>Animal<\/code> and override the <code>makeSound()<\/code> method.<\/li> <li>In the <code>Main<\/code> class, we declare a variable <code>myAnimal<\/code> of type <code>Animal<\/code>. We then instantiate <code>Dog<\/code> and <code>Cat<\/code> objects, but treat them as <code>Animal<\/code> objects. This is where polymorphism is at play.<\/li> <li>When we call <code>myAnimal.makeSound()<\/code>, the version of the method that gets executed depends on the actual object type (<code>Dog<\/code> or <code>Cat<\/code>), not the reference type (<code>Animal<\/code>).<\/li><\/ul><h4 class=\"wp-block-heading\"> <\/h4><p>\u00a0<\/p><h4 class=\"wp-block-heading\"><\/h4><p><\/p><p><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Lessons Lessons &nbsp; Setting Up Your Development Environment Java Basics &#8211; Syntax, Variables, Data Types, and Operators Understanding Objects and Classes in Java Understanding Encapsulation in Java Understanding Inheritance in Java: The &#8220;Is-A&#8221; Relationship Understanding Constructors in Java Inheritance Understanding Access Modifiers in Java Inheritance Understanding Polymorphism in Java Understanding Polymorphism in Java<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":3335,"menu_order":7,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-3393","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Understanding Polymorphism in Java - Sankham Technologies<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-polymorphism-in-java\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Understanding Polymorphism in Java - Sankham Technologies\" \/>\n<meta property=\"og:description\" content=\"Lessons Lessons &nbsp; Setting Up Your Development Environment Java Basics &#8211; Syntax, Variables, Data Types, and Operators Understanding Objects and Classes in Java Understanding Encapsulation in Java Understanding Inheritance in Java: The &#8220;Is-A&#8221; Relationship Understanding Constructors in Java Inheritance Understanding Access Modifiers in Java Inheritance Understanding Polymorphism in Java Understanding Polymorphism in Java\" \/>\n<meta property=\"og:url\" content=\"https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-polymorphism-in-java\/\" \/>\n<meta property=\"og:site_name\" content=\"Sankham Technologies\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-15T16:15:10+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/sankhamtech.com\\\/index.php\\\/content\\\/in\\\/en\\\/home\\\/free-courses\\\/understanding-object-oriented-programming-in-java\\\/understanding-polymorphism-in-java\\\/\",\"url\":\"https:\\\/\\\/sankhamtech.com\\\/index.php\\\/content\\\/in\\\/en\\\/home\\\/free-courses\\\/understanding-object-oriented-programming-in-java\\\/understanding-polymorphism-in-java\\\/\",\"name\":\"Understanding Polymorphism in Java - Sankham Technologies\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/sankhamtech.com\\\/#website\"},\"datePublished\":\"2024-11-15T16:14:33+00:00\",\"dateModified\":\"2024-11-15T16:15:10+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/sankhamtech.com\\\/index.php\\\/content\\\/in\\\/en\\\/home\\\/free-courses\\\/understanding-object-oriented-programming-in-java\\\/understanding-polymorphism-in-java\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/sankhamtech.com\\\/index.php\\\/content\\\/in\\\/en\\\/home\\\/free-courses\\\/understanding-object-oriented-programming-in-java\\\/understanding-polymorphism-in-java\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/sankhamtech.com\\\/index.php\\\/content\\\/in\\\/en\\\/home\\\/free-courses\\\/understanding-object-oriented-programming-in-java\\\/understanding-polymorphism-in-java\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/sankhamtech.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Content\",\"item\":\"https:\\\/\\\/sankhamtech.com\\\/index.php\\\/content\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"India\",\"item\":\"https:\\\/\\\/sankhamtech.com\\\/index.php\\\/content\\\/in\\\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"English\",\"item\":\"https:\\\/\\\/sankhamtech.com\\\/index.php\\\/content\\\/in\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Home\",\"item\":\"https:\\\/\\\/sankhamtech.com\\\/\"},{\"@type\":\"ListItem\",\"position\":6,\"name\":\"Free Courses\",\"item\":\"https:\\\/\\\/sankhamtech.com\\\/index.php\\\/content\\\/in\\\/en\\\/home\\\/free-courses\\\/\"},{\"@type\":\"ListItem\",\"position\":7,\"name\":\"Understanding Object-Oriented Programming in Java\",\"item\":\"https:\\\/\\\/sankhamtech.com\\\/indexphp\\\/content\\\/in\\\/en\\\/home\\\/free-courses\\\/understanding-object-oriented-programming-in-java\\\/\"},{\"@type\":\"ListItem\",\"position\":8,\"name\":\"Understanding Polymorphism in Java\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/sankhamtech.com\\\/#website\",\"url\":\"https:\\\/\\\/sankhamtech.com\\\/\",\"name\":\"Sankham Technologies\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/sankhamtech.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/sankhamtech.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/sankhamtech.com\\\/#organization\",\"name\":\"Sankham Technologies\",\"url\":\"https:\\\/\\\/sankhamtech.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/sankhamtech.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/sankhamtech.com\\\/wp-content\\\/uploads\\\/2023\\\/12\\\/Logo-Dark-1.png\",\"contentUrl\":\"https:\\\/\\\/sankhamtech.com\\\/wp-content\\\/uploads\\\/2023\\\/12\\\/Logo-Dark-1.png\",\"width\":306,\"height\":74,\"caption\":\"Sankham Technologies\"},\"image\":{\"@id\":\"https:\\\/\\\/sankhamtech.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Understanding Polymorphism in Java - Sankham Technologies","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:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-polymorphism-in-java\/","og_locale":"en_US","og_type":"article","og_title":"Understanding Polymorphism in Java - Sankham Technologies","og_description":"Lessons Lessons &nbsp; Setting Up Your Development Environment Java Basics &#8211; Syntax, Variables, Data Types, and Operators Understanding Objects and Classes in Java Understanding Encapsulation in Java Understanding Inheritance in Java: The &#8220;Is-A&#8221; Relationship Understanding Constructors in Java Inheritance Understanding Access Modifiers in Java Inheritance Understanding Polymorphism in Java Understanding Polymorphism in Java","og_url":"https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-polymorphism-in-java\/","og_site_name":"Sankham Technologies","article_modified_time":"2024-11-15T16:15:10+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-polymorphism-in-java\/","url":"https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-polymorphism-in-java\/","name":"Understanding Polymorphism in Java - Sankham Technologies","isPartOf":{"@id":"https:\/\/sankhamtech.com\/#website"},"datePublished":"2024-11-15T16:14:33+00:00","dateModified":"2024-11-15T16:15:10+00:00","breadcrumb":{"@id":"https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-polymorphism-in-java\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-polymorphism-in-java\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-polymorphism-in-java\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/sankhamtech.com\/"},{"@type":"ListItem","position":2,"name":"Content","item":"https:\/\/sankhamtech.com\/index.php\/content\/"},{"@type":"ListItem","position":3,"name":"India","item":"https:\/\/sankhamtech.com\/index.php\/content\/in\/"},{"@type":"ListItem","position":4,"name":"English","item":"https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/"},{"@type":"ListItem","position":5,"name":"Home","item":"https:\/\/sankhamtech.com\/"},{"@type":"ListItem","position":6,"name":"Free Courses","item":"https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/"},{"@type":"ListItem","position":7,"name":"Understanding Object-Oriented Programming in Java","item":"https:\/\/sankhamtech.com\/indexphp\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/"},{"@type":"ListItem","position":8,"name":"Understanding Polymorphism in Java"}]},{"@type":"WebSite","@id":"https:\/\/sankhamtech.com\/#website","url":"https:\/\/sankhamtech.com\/","name":"Sankham Technologies","description":"","publisher":{"@id":"https:\/\/sankhamtech.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/sankhamtech.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/sankhamtech.com\/#organization","name":"Sankham Technologies","url":"https:\/\/sankhamtech.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/sankhamtech.com\/#\/schema\/logo\/image\/","url":"https:\/\/sankhamtech.com\/wp-content\/uploads\/2023\/12\/Logo-Dark-1.png","contentUrl":"https:\/\/sankhamtech.com\/wp-content\/uploads\/2023\/12\/Logo-Dark-1.png","width":306,"height":74,"caption":"Sankham Technologies"},"image":{"@id":"https:\/\/sankhamtech.com\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/sankhamtech.com\/index.php\/wp-json\/wp\/v2\/pages\/3393","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sankhamtech.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/sankhamtech.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/sankhamtech.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sankhamtech.com\/index.php\/wp-json\/wp\/v2\/comments?post=3393"}],"version-history":[{"count":4,"href":"https:\/\/sankhamtech.com\/index.php\/wp-json\/wp\/v2\/pages\/3393\/revisions"}],"predecessor-version":[{"id":3397,"href":"https:\/\/sankhamtech.com\/index.php\/wp-json\/wp\/v2\/pages\/3393\/revisions\/3397"}],"up":[{"embeddable":true,"href":"https:\/\/sankhamtech.com\/index.php\/wp-json\/wp\/v2\/pages\/3335"}],"wp:attachment":[{"href":"https:\/\/sankhamtech.com\/index.php\/wp-json\/wp\/v2\/media?parent=3393"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}