{"id":5492,"date":"2023-10-21T17:26:24","date_gmt":"2023-10-22T00:26:24","guid":{"rendered":"https:\/\/ioflood.com\/blog\/?p=5492"},"modified":"2024-02-26T10:53:01","modified_gmt":"2024-02-26T17:53:01","slug":"polymorphism-java","status":"publish","type":"post","link":"https:\/\/ioflood.com\/blog\/polymorphism-java\/","title":{"rendered":"Java Polymorphism: Class and Object Manipulation Guide"},"content":{"rendered":"<div class=\"wp-block-image\">\n<figure class=\"alignright size-full is-resized\"><img decoding=\"async\" src=\"https:\/\/ioflood.com\/blog\/wp-content\/uploads\/2023\/10\/shapes-transforming-to-different-forms-symbolizing-Java-polymorphism-300x300.jpg\" alt=\"shapes transforming to different forms symbolizing Java polymorphism\" width=\"300\" height=\"300\" title=\"\"><\/figure>\n<\/div>\n<p>Ever felt like you&#8217;re wrestling with understanding polymorphism in Java? You&#8217;re not alone. Many developers find the concept of polymorphism a bit daunting. Think of Java&#8217;s polymorphism as a chameleon &#8211; it allows objects to take on many forms, providing a versatile and handy tool for various tasks.<\/p>\n<p>Polymorphism is a powerful way to extend the functionality of your Java code, making it extremely popular for creating flexible and reusable code.<\/p>\n<p><strong>In this guide, we&#8217;ll walk you through the process of understanding and implementing polymorphism in Java, from the basics to more advanced techniques.<\/strong> We&#8217;ll cover everything from making simple polymorphic references, handling different types of polymorphism (overloading, overriding, interface polymorphism), to dealing with common issues and even troubleshooting.<\/p>\n<p>Let&#8217;s kick things off and learn to master polymorphism in Java!<\/p>\n<h2>TL;DR: What is Polymorphism in Java?<\/h2>\n<blockquote><p>\n  Polymorphism in Java is a concept where an object can take on many forms. The most common use of polymorphism in Object-Oriented Programming (OOP) occurs when a parent class reference is used to refer to a child class object, such as in the line of code <code>Animal myPig = new Pig();<\/code>\n<\/p><\/blockquote>\n<p>Here&#8217;s a simple example:<\/p>\n<pre><code class=\"language-java line-numbers\">class Animal {\n  void sound() {\n    System.out.println('The animal makes a sound');\n  }\n}\n\nclass Pig extends Animal {\n  void sound() {\n    System.out.println('The pig says: wee wee');\n  }\n}\n\nAnimal myPig = new Pig();\nmyPig.sound();\n\n\/\/ Output:\n\/\/ 'The pig says: wee wee'\n<\/code><\/pre>\n<p>In this example, we have a base class <code>Animal<\/code> with a method <code>sound()<\/code>. We then create a <code>Pig<\/code> class that extends <code>Animal<\/code> and overrides the <code>sound()<\/code> method. When we create a <code>Pig<\/code> object and assign it to an <code>Animal<\/code> reference, the overridden <code>sound()<\/code> method in the <code>Pig<\/code> class is called, demonstrating polymorphism.<\/p>\n<blockquote><p>\n  This is just a basic example of polymorphism in Java. Continue reading for a more detailed understanding of polymorphism, including its various types and how to use it effectively in your Java programs.\n<\/p><\/blockquote>\n<h2>Exploring Polymorphism in Java: The Basics<\/h2>\n<p>Polymorphism, a key pillar of Object-Oriented Programming (OOP), is a Greek word that means &#8216;many shapes&#8217;. In Java, polymorphism allows objects to behave in multiple ways depending on their actual implemented classes.<\/p>\n<h3>Polymorphism in Action: A Simple Example<\/h3>\n<p>Let&#8217;s start with an easy-to-understand example:<\/p>\n<pre><code class=\"language-java line-numbers\">\/\/ Base class\nclass Bird {\n  void fly() {\n    System.out.println('The bird is flying.');\n  }\n}\n\n\/\/ Subclass\nclass Sparrow extends Bird {\n  void fly() {\n    System.out.println('The sparrow flies low.');\n  }\n}\n\n\/\/ Main class\npublic class Main {\n  public static void main(String[] args) {\n    Bird myBird = new Sparrow();\n    myBird.fly();\n  }\n}\n\n\/\/ Output:\n\/\/ 'The sparrow flies low.'\n<\/code><\/pre>\n<p>In this example, we have a base class <code>Bird<\/code> with a method <code>fly()<\/code>. We then create a <code>Sparrow<\/code> class that extends <code>Bird<\/code> and overrides the <code>fly()<\/code> method. When we create a <code>Sparrow<\/code> object and assign it to a <code>Bird<\/code> reference, the overridden <code>fly()<\/code> method in the <code>Sparrow<\/code> class is called. This is a basic demonstration of polymorphism in Java.<\/p>\n<h3>Advantages of Using Polymorphism<\/h3>\n<p>Polymorphism can make your code more flexible and maintainable. It allows you to write code that does not need to be changed when new objects are added, making it easier to develop and upgrade your software.<\/p>\n<h3>Potential Pitfalls<\/h3>\n<p>While polymorphism is powerful, it can lead to confusion if not used carefully. Overriding methods can lead to unexpected behavior if you&#8217;re not aware that a method has been overridden. Also, you can&#8217;t use subclass-specific methods and variables when referring to an object with a superclass reference, which can limit functionality.<\/p>\n<h2>Diving Deeper: Advanced Polymorphism in Java<\/h2>\n<p>As you become more comfortable with polymorphism, you can start exploring its advanced uses. Let&#8217;s discuss three more complex forms of polymorphism in Java: method overriding, method overloading, and interface polymorphism.<\/p>\n<h3>Method Overriding<\/h3>\n<p>Method overriding is a key aspect of polymorphism where a subclass provides a specific implementation of a method that is already defined in its parent class.<\/p>\n<pre><code class=\"language-java line-numbers\">\/\/ Base class\nclass Animal {\n  void sound() {\n    System.out.println('The animal makes a sound');\n  }\n}\n\n\/\/ Subclass\nclass Dog extends Animal {\n  void sound() {\n    System.out.println('The dog says: woof woof');\n  }\n}\n\n\/\/ Main class\npublic class Main {\n  public static void main(String[] args) {\n    Animal myDog = new Dog();\n    myDog.sound();\n  }\n}\n\n\/\/ Output:\n\/\/ 'The dog says: woof woof'\n<\/code><\/pre>\n<p>In this example, the <code>Dog<\/code> class overrides the <code>sound()<\/code> method defined in the <code>Animal<\/code> class. When we create a <code>Dog<\/code> object and assign it to an <code>Animal<\/code> reference, the overridden <code>sound()<\/code> method in the <code>Dog<\/code> class is called.<\/p>\n<h3>Method Overloading<\/h3>\n<p>Method overloading is another form of polymorphism where a class can have multiple methods with the same name but different parameters.<\/p>\n<pre><code class=\"language-java line-numbers\">\/\/ Overloaded methods\nclass Display {\n  void show(int num) {\n    System.out.println('Displaying an integer: ' + num);\n  }\n\n  void show(String str) {\n    System.out.println('Displaying a string: ' + str);\n  }\n}\n\n\/\/ Main class\npublic class Main {\n  public static void main(String[] args) {\n    Display display = new Display();\n    display.show(10);\n    display.show('Hello');\n  }\n}\n\n\/\/ Output:\n\/\/ 'Displaying an integer: 10'\n\/\/ 'Displaying a string: Hello'\n<\/code><\/pre>\n<p>In this example, we&#8217;ve overloaded the <code>show()<\/code> method in the <code>Display<\/code> class. When called with an integer, it prints an integer. When called with a string, it prints a string.<\/p>\n<h3>Interface Polymorphism<\/h3>\n<p>Interface polymorphism is a powerful feature in Java that allows an object to take on multiple forms. This is achieved by implementing multiple interfaces.<\/p>\n<pre><code class=\"language-java line-numbers\">\/\/ Interfaces\ninterface Eater {\n  void eat();\n}\n\ninterface Sleeper {\n  void sleep();\n}\n\n\/\/ Class implementing interfaces\nclass Human implements Eater, Sleeper {\n  public void eat() {\n    System.out.println('The human is eating.');\n  }\n\n  public void sleep() {\n    System.out.println('The human is sleeping.');\n  }\n}\n\n\/\/ Main class\npublic class Main {\n  public static void main(String[] args) {\n    Human human = new Human();\n    human.eat();\n    human.sleep();\n  }\n}\n\n\/\/ Output:\n\/\/ 'The human is eating.'\n\/\/ 'The human is sleeping.'\n<\/code><\/pre>\n<p>In this example, the <code>Human<\/code> class implements both the <code>Eater<\/code> and <code>Sleeper<\/code> interfaces. This allows a <code>Human<\/code> object to take on the form of an <code>Eater<\/code> and a <code>Sleeper<\/code>, demonstrating interface polymorphism.<\/p>\n<h2>Exploring Alternatives: Abstract Classes and Interfaces<\/h2>\n<p>While polymorphism is a powerful tool in Java, there are alternative approaches to achieve similar outcomes. Two such alternatives are abstract classes and interfaces.<\/p>\n<h3>Abstract Classes<\/h3>\n<p>Abstract classes in Java are classes that contain one or more abstract methods &#8211; methods declared without an implementation. Abstract classes cannot be instantiated, but they can be subclassed.<\/p>\n<pre><code class=\"language-java line-numbers\">\/\/ Abstract class\nabstract class Animal {\n  abstract void sound();\n}\n\n\/\/ Subclass\nclass Cat extends Animal {\n  void sound() {\n    System.out.println('The cat says: meow meow');\n  }\n}\n\n\/\/ Main class\npublic class Main {\n  public static void main(String[] args) {\n    Animal myCat = new Cat();\n    myCat.sound();\n  }\n}\n\n\/\/ Output:\n\/\/ 'The cat says: meow meow'\n<\/code><\/pre>\n<p>In this example, <code>Animal<\/code> is an abstract class with an abstract method <code>sound()<\/code>. The <code>Cat<\/code> class extends <code>Animal<\/code> and provides an implementation for <code>sound()<\/code>. When a <code>Cat<\/code> object is created and assigned to an <code>Animal<\/code> reference, the <code>sound()<\/code> method in <code>Cat<\/code> is called.<\/p>\n<h3>Interfaces<\/h3>\n<p>An interface in Java is a completely abstract class that can only contain abstract methods. It can be used to achieve full abstraction and multiple inheritance in Java.<\/p>\n<pre><code class=\"language-java line-numbers\">\/\/ Interface\ninterface Runner {\n  void run();\n}\n\n\/\/ Class implementing interface\nclass Athlete implements Runner {\n  public void run() {\n    System.out.println('The athlete runs fast.');\n  }\n}\n\n\/\/ Main class\npublic class Main {\n  public static void main(String[] args) {\n    Runner athlete = new Athlete();\n    athlete.run();\n  }\n}\n\n\/\/ Output:\n\/\/ 'The athlete runs fast.'\n<\/code><\/pre>\n<p>In this example, <code>Runner<\/code> is an interface with a method <code>run()<\/code>. The <code>Athlete<\/code> class implements <code>Runner<\/code> and provides an implementation for <code>run()<\/code>. When an <code>Athlete<\/code> object is created and assigned to a <code>Runner<\/code> reference, the <code>run()<\/code> method in <code>Athlete<\/code> is called.<\/p>\n<h3>Making the Right Choice<\/h3>\n<p>Choosing between polymorphism, abstract classes, and interfaces depends on your specific needs. If you need to create objects that share a common behavior but also have their unique behaviors, polymorphism is the way to go. If you need to define a template for a group of classes, consider using abstract classes. If you want to define a contract for classes or achieve multiple inheritance, interfaces are your best bet.<\/p>\n<h2>Troubleshooting Polymorphism in Java: Common Issues and Solutions<\/h2>\n<p>While polymorphism can streamline your Java code, you might encounter some hurdles along the way. Let&#8217;s explore some common issues related to polymorphism and how to tackle them.<\/p>\n<h3>Type Casting Errors<\/h3>\n<p>A common issue when dealing with polymorphism is type casting errors. These usually occur when you attempt to cast an object of one type to another incompatible type.<\/p>\n<pre><code class=\"language-java line-numbers\">\/\/ Incorrect casting\nclass Animal {}\nclass Dog extends Animal {}\n\n\/\/ Main class\npublic class Main {\n  public static void main(String[] args) {\n    Animal animal = new Animal();\n    Dog dog = (Dog) animal; \/\/ This will throw a ClassCastException\n  }\n}\n<\/code><\/pre>\n<p>In this example, we&#8217;re trying to cast an <code>Animal<\/code> object to a <code>Dog<\/code> object, which throws a <code>ClassCastException<\/code>. To avoid this, ensure that the object being cast is actually an instance of the class you&#8217;re trying to cast to.<\/p>\n<pre><code class=\"language-java line-numbers\">\/\/ Correct casting\nclass Animal {}\nclass Dog extends Animal {}\n\n\/\/ Main class\npublic class Main {\n  public static void main(String[] args) {\n    Animal animal = new Dog(); \/\/ This is a Dog object referred to by an Animal reference\n    Dog dog = (Dog) animal; \/\/ This is correct and won't throw an exception\n  }\n}\n<\/code><\/pre>\n<p>In this corrected example, we&#8217;re assigning a <code>Dog<\/code> object to an <code>Animal<\/code> reference, then casting it back to a <code>Dog<\/code> object. Since the original object was a <code>Dog<\/code>, this doesn&#8217;t throw an exception.<\/p>\n<h3>Method Resolution Problems<\/h3>\n<p>Another common issue is method resolution problems. These usually occur when the method to be invoked is determined by the JVM at runtime based on the actual object, not the reference type.<\/p>\n<pre><code class=\"language-java line-numbers\">\/\/ Method resolution issue\nclass Animal {\n  void sound() {\n    System.out.println('The animal makes a sound');\n  }\n\n  void eat() {\n    System.out.println('The animal is eating');\n  }\n}\n\nclass Dog extends Animal {\n  void sound() {\n    System.out.println('The dog says: woof woof');\n  }\n\n  void wagTail() {\n    System.out.println('The dog is wagging its tail');\n  }\n}\n\n\/\/ Main class\npublic class Main {\n  public static void main(String[] args) {\n    Animal myDog = new Dog();\n    myDog.wagTail(); \/\/ This will throw a compile error\n  }\n}\n<\/code><\/pre>\n<p>In this example, we&#8217;re trying to invoke the <code>wagTail()<\/code> method on a <code>Dog<\/code> object referred to by an <code>Animal<\/code> reference. Since <code>wagTail()<\/code> is not a method in the <code>Animal<\/code> class, this throws a compile error. To avoid this, ensure that the method you&#8217;re trying to invoke exists in the reference type&#8217;s class.<\/p>\n<p>Remember, understanding the concept of polymorphism and its potential issues is key to effectively using it in your Java programs. With careful implementation and the right troubleshooting techniques, you can harness the full power of polymorphism in Java.<\/p>\n<h2>Unpacking OOP: The Backbone of Polymorphism<\/h2>\n<p>To fully grasp polymorphism in Java, we need to delve into the principles of Object-Oriented Programming (OOP) that underpin it. OOP is a programming paradigm based on the concept of &#8216;objects&#8217;, which can contain data and code: data in the form of fields (often known as attributes), and code, in the form of procedures (often known as methods).<\/p>\n<h3>Inheritance: The Parent-Child Relationship<\/h3>\n<p>Inheritance is one of the core principles of OOP. It allows a class (child) to inherit the properties and methods of another class (parent). This means that the child class can reuse the code from the parent class, with the ability to introduce specific behavior.<\/p>\n<pre><code class=\"language-java line-numbers\">\/\/ Parent class\nclass Animal {\n  void sound() {\n    System.out.println('The animal makes a sound');\n  }\n}\n\n\/\/ Child class\nclass Dog extends Animal {\n  void sound() {\n    System.out.println('The dog says: woof woof');\n  }\n}\n\n\/\/ Main class\npublic class Main {\n  public static void main(String[] args) {\n    Animal myDog = new Dog();\n    myDog.sound();\n  }\n}\n\n\/\/ Output:\n\/\/ 'The dog says: woof woof'\n<\/code><\/pre>\n<p>In this example, the <code>Dog<\/code> class inherits from the <code>Animal<\/code> class. This means <code>Dog<\/code> has access to the <code>sound()<\/code> method in <code>Animal<\/code>. However, <code>Dog<\/code> chooses to override this method to provide its own implementation. This is an example of inheritance in action.<\/p>\n<h3>Encapsulation: Bundling Data and Methods<\/h3>\n<p>Encapsulation is another fundamental principle of OOP. It&#8217;s the mechanism of bundling the data (attributes) and the methods that operate on the data. It also hides the complexity of the operations from the users, providing a simple interface.<\/p>\n<pre><code class=\"language-java line-numbers\">\/\/ Encapsulation example\nclass Car {\n  private String color;\n\n  \/\/ Getter\n  public String getColor() {\n    return color;\n  }\n\n  \/\/ Setter\n  public void setColor(String c) {\n    this.color = c;\n  }\n}\n\n\/\/ Main class\npublic class Main {\n  public static void main(String[] args) {\n    Car myCar = new Car();\n    myCar.setColor('Red');\n    System.out.println(myCar.getColor());\n  }\n}\n\n\/\/ Output:\n\/\/ 'Red'\n<\/code><\/pre>\n<p>In this example, we encapsulate the <code>color<\/code> attribute in the <code>Car<\/code> class. We provide a getter method <code>getColor()<\/code> to access the value of <code>color<\/code>, and a setter method <code>setColor()<\/code> to modify it. This is an example of encapsulation in action.<\/p>\n<h3>The Role of Polymorphism in OOP<\/h3>\n<p>Polymorphism, alongside inheritance and encapsulation, is a fundamental principle of OOP. It allows objects to take on many forms, depending on their data types, class or interface. This makes Java code more flexible and dynamic. As we&#8217;ve seen in the examples above, polymorphism allows a child class to provide a specific implementation of a method that is already provided by its parent class.<\/p>\n<h2>Polymorphism in the Bigger Picture: Design Patterns and Frameworks<\/h2>\n<p>Polymorphism isn&#8217;t just a standalone concept. It&#8217;s a cornerstone of larger Java projects, playing a critical role in design patterns and frameworks. It allows objects of different types to be processed in a uniform way, making it easier to manage complexity in larger software systems.<\/p>\n<h3>Polymorphism in Design Patterns<\/h3>\n<p>Many design patterns in Java, such as Strategy, State, and Observer, rely on polymorphism. These patterns use polymorphism to provide loose coupling, making the code more flexible and maintainable.<\/p>\n<h3>Polymorphism in Frameworks<\/h3>\n<p>Java frameworks like Spring and Hibernate heavily utilize polymorphism. For instance, in Spring, polymorphism is used in dependency injection, where a base class reference can be injected with any subclass object at runtime.<\/p>\n<h2>Exploring Related Concepts: Abstraction and Encapsulation<\/h2>\n<p>Polymorphism is just one piece of the OOP puzzle. To truly master Java programming, it&#8217;s essential to understand related concepts like abstraction and encapsulation.<\/p>\n<p>Abstraction is the process of hiding the implementation details and showing only the functionality to the user. Encapsulation, as we discussed earlier, is the technique of making the fields in a class private and providing access through public methods.<\/p>\n<h2>Further Resources for Mastering Polymorphism in Java<\/h2>\n<p>Ready to dive deeper into polymorphism in Java? Here are some excellent resources to help you on your journey:<\/p>\n<ul>\n<li><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/ioflood.com\/blog\/java-oops-concepts\/\">Demystifying Java OOPs Concepts<\/a> &#8211; Explore the principles of code reusability and maintainability in Java OOP.<\/p>\n<\/li>\n<li>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/ioflood.com\/blog\/abstraction-in-java\/\">Using Abstraction in Java<\/a> &#8211; Master abstraction for simplifying program design and maintenance in Java.<\/p>\n<\/li>\n<li>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/ioflood.com\/blog\/java-multiple-inheritance\/\">Multiple Inheritance in Java<\/a> &#8211; Explore the concept of multiple inheritance in Java and its limitations.<\/p>\n<\/li>\n<li>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/docs.oracle.com\/javase\/tutorial\/java\/IandI\/polymorphism.html\" target=\"_blank\" rel=\"noopener\">Oracle&#8217;s Java Tutorials<\/a> provides comprehensive tutorials on all Java concepts, including polymorphism.<\/p>\n<\/li>\n<li>\n<p>GeeksforGeeks&#8217; <a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/www.geeksforgeeks.org\/java\/\" target=\"_blank\" rel=\"noopener\">Java Programming<\/a> collection offers Java programming articles, including discussions on polymorphism.<\/p>\n<\/li>\n<li>\n<p>Baeldung&#8217;s <a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/www.baeldung.com\/java-polymorphism\" target=\"_blank\" rel=\"noopener\">Guide to Polymorphism in Java<\/a> provides a practical approach to understanding polymorphism in Java.<\/p>\n<\/li>\n<\/ul>\n<h2>Wrapping Up: Navigating Polymorphism in Java<\/h2>\n<p>In this comprehensive guide, we&#8217;ve taken a deep dive into the world of polymorphism in Java, a fundamental concept in Object-Oriented Programming (OOP) that allows an object to take on many forms.<\/p>\n<p>We began with the basics, understanding what polymorphism is and how it&#8217;s implemented in Java. We then explored more advanced techniques, discussing method overriding, method overloading, and interface polymorphism. We also tackled common issues you might encounter when implementing polymorphism, such as type casting errors and method resolution problems, offering solutions to these challenges.<\/p>\n<p>We didn&#8217;t stop there. We looked at alternative approaches to achieve similar outcomes, such as abstract classes and interfaces. We also delved into the principles of OOP that underlie polymorphism, like inheritance and encapsulation. Finally, we discussed the role of polymorphism in larger Java projects, including its application in design patterns and frameworks.<\/p>\n<table>\n<thead>\n<tr>\n<th>Concept<\/th>\n<th>Description<\/th>\n<th>Use Case<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Polymorphism<\/td>\n<td>Allows an object to take on many forms<\/td>\n<td>When you want to extend the functionality of your code<\/td>\n<\/tr>\n<tr>\n<td>Abstract Classes<\/td>\n<td>Defines a template for a group of classes<\/td>\n<td>When you want to provide common behavior for related classes<\/td>\n<\/tr>\n<tr>\n<td>Interfaces<\/td>\n<td>Defines a contract for classes<\/td>\n<td>When you want to ensure certain methods are implemented<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Whether you&#8217;re a beginner just starting out with Java or an experienced developer looking to level up your understanding of polymorphism, we hope this guide has been a valuable resource. Polymorphism is a powerful tool in your Java toolkit, enabling you to write more flexible and maintainable code. Now, you&#8217;re well equipped to harness the power of polymorphism in your future Java projects. Happy coding!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ever felt like you&#8217;re wrestling with understanding polymorphism in Java? You&#8217;re not alone. Many developers find the concept of polymorphism a bit daunting. Think of Java&#8217;s polymorphism as a chameleon &#8211; it allows objects to take on many forms, providing a versatile and handy tool for various tasks. Polymorphism is a powerful way to extend [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":10246,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[154,121],"tags":[],"class_list":["post-5492","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","category-programming-coding","cat-154-id","cat-121-id","has_thumb"],"_links":{"self":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts\/5492","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/comments?post=5492"}],"version-history":[{"count":10,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts\/5492\/revisions"}],"predecessor-version":[{"id":5622,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts\/5492\/revisions\/5622"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/media\/10246"}],"wp:attachment":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/media?parent=5492"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/categories?post=5492"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/tags?post=5492"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}