{"id":4079,"date":"2024-09-21T11:59:45","date_gmt":"2024-09-21T06:59:45","guid":{"rendered":"https:\/\/afzalbadshah.com\/?p=4079"},"modified":"2024-09-24T08:50:26","modified_gmt":"2024-09-24T03:50:26","slug":"understanding-modifiers-in-java","status":"publish","type":"post","link":"https:\/\/afzalbadshah.com\/index.php\/2024\/09\/21\/understanding-modifiers-in-java\/","title":{"rendered":"Understanding Modifiers in Java"},"content":{"rendered":"\n<p>Modifiers in Java are used to <strong>control the behaviour and accessibility<\/strong> of classes, methods, and variables. They define who can access certain parts of a program and how the components of the class behave. Modifiers are categorized into two main types: <strong>Access Modifiers<\/strong> and <strong>Non-Access Modifiers<\/strong>. Access modifiers determine the visibility of classes and their members, while non-access modifiers control aspects like immutability or the necessity of subclass implementation. <a href=\"https:\/\/afzalbadshah.com\/index.php\/comprehensive-guide-to-object-oriented-programming-oop-in-java\/\" target=\"_blank\" rel=\"noopener\" title=\"\">Visit the detailed tutorial here. <\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Access Modifiers<\/h2>\n\n\n\n<p>In Java, access modifiers determine who can access or modify classes, attributes, and methods. These modifiers help manage access control within your program, ensuring that important data is protected while allowing access to essential functionalities. There are three primary access modifiers in Java: <strong>public<\/strong>, <strong>private<\/strong>, and <strong>protected<\/strong>.<\/p>\n\n\n\n<p>Let\u2019s explore these access modifiers step by step, using the <strong>Calculator<\/strong> program.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public class Calculator {\n\n    \/\/ Attributes of the class\n    private int a;\n    private int b;\n\n    \/\/ Method for sum\n    public int sum(int a, int b) {\n        return a + b;\n    }\n\n    \/\/ Method for subtraction\n    public int subtract(int a, int b) {\n        return a - b;\n    }\n\n    \/\/ Method for multiplication\n    public int multiply(int a, int b) {\n        return a * b;\n    }\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Public Modifier<\/strong><\/h3>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"640\" height=\"144\" src=\"https:\/\/i0.wp.com\/afzalbadshah.com\/wp-content\/uploads\/2024\/09\/OOP-Public.drawio-1.png?resize=640%2C144&#038;ssl=1\" alt=\"\" class=\"wp-image-4089\" srcset=\"https:\/\/i0.wp.com\/afzalbadshah.com\/wp-content\/uploads\/2024\/09\/OOP-Public.drawio-1.png?resize=1024%2C231&amp;ssl=1 1024w, https:\/\/i0.wp.com\/afzalbadshah.com\/wp-content\/uploads\/2024\/09\/OOP-Public.drawio-1.png?resize=300%2C68&amp;ssl=1 300w, https:\/\/i0.wp.com\/afzalbadshah.com\/wp-content\/uploads\/2024\/09\/OOP-Public.drawio-1.png?resize=768%2C173&amp;ssl=1 768w, https:\/\/i0.wp.com\/afzalbadshah.com\/wp-content\/uploads\/2024\/09\/OOP-Public.drawio-1.png?resize=1536%2C347&amp;ssl=1 1536w, https:\/\/i0.wp.com\/afzalbadshah.com\/wp-content\/uploads\/2024\/09\/OOP-Public.drawio-1.png?resize=604%2C136&amp;ssl=1 604w, https:\/\/i0.wp.com\/afzalbadshah.com\/wp-content\/uploads\/2024\/09\/OOP-Public.drawio-1.png?w=1702&amp;ssl=1 1702w, https:\/\/i0.wp.com\/afzalbadshah.com\/wp-content\/uploads\/2024\/09\/OOP-Public.drawio-1.png?w=1280&amp;ssl=1 1280w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/figure>\n\n\n\n<p>When you declare a class, method, or variable as <strong>public<\/strong>, it can be accessed from anywhere in your program. In the example above, the <code>Calculator<\/code> class is declared <strong>public<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public class Calculator { \n     public int a;\n     public int b;\n\npublic int sum(a, b) {\n        return a + b;\n    }\n\n}<\/code><\/pre>\n\n\n\n<p>This means that <strong>any other class<\/strong> can create an object of the <code>Calculator<\/code> class and use its methods. For example, you could create an object of this class and use its methods like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Calculator calc = new Calculator();\nint result = calc.sum(10, 5);<\/code><\/pre>\n\n\n\n<p>Here, the <code>sum<\/code>, <code>subtract<\/code>, and <code>multiply<\/code> methods are also declared <strong>public<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public int sum(int a, int b) { \n    return a + b; \n}<\/code><\/pre>\n\n\n\n<p>Since these methods are public, they are <strong>accessible from anywhere<\/strong> in your code. So, if another class wants to call any of these methods, it can do so without any restrictions. You use the <strong>public<\/strong> modifier when you want methods or attributes to be available for <strong>interaction with other classes<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Private Modifier<\/strong><\/h3>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"640\" height=\"144\" src=\"https:\/\/i0.wp.com\/afzalbadshah.com\/wp-content\/uploads\/2024\/09\/OOP-Private.drawio-1.png?resize=640%2C144&#038;ssl=1\" alt=\"\" class=\"wp-image-4090\" srcset=\"https:\/\/i0.wp.com\/afzalbadshah.com\/wp-content\/uploads\/2024\/09\/OOP-Private.drawio-1.png?resize=1024%2C230&amp;ssl=1 1024w, https:\/\/i0.wp.com\/afzalbadshah.com\/wp-content\/uploads\/2024\/09\/OOP-Private.drawio-1.png?resize=300%2C67&amp;ssl=1 300w, https:\/\/i0.wp.com\/afzalbadshah.com\/wp-content\/uploads\/2024\/09\/OOP-Private.drawio-1.png?resize=768%2C172&amp;ssl=1 768w, https:\/\/i0.wp.com\/afzalbadshah.com\/wp-content\/uploads\/2024\/09\/OOP-Private.drawio-1.png?resize=1536%2C344&amp;ssl=1 1536w, https:\/\/i0.wp.com\/afzalbadshah.com\/wp-content\/uploads\/2024\/09\/OOP-Private.drawio-1.png?resize=604%2C135&amp;ssl=1 604w, https:\/\/i0.wp.com\/afzalbadshah.com\/wp-content\/uploads\/2024\/09\/OOP-Private.drawio-1.png?w=1704&amp;ssl=1 1704w, https:\/\/i0.wp.com\/afzalbadshah.com\/wp-content\/uploads\/2024\/09\/OOP-Private.drawio-1.png?w=1280&amp;ssl=1 1280w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/figure>\n\n\n\n<p>The <strong>private<\/strong> modifier is used to restrict access to certain variables or methods within the class itself. It means that anything declared private <strong>can only be accessed inside that class<\/strong> and cannot be accessed or modified directly by any other class.<\/p>\n\n\n\n<p>In <code>Calculator<\/code> program, the attributes <code>a<\/code> and <code>b<\/code> are declared private:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>private int a;\nprivate int b;<\/code><\/pre>\n\n\n\n<p>These variables are <strong>only accessible<\/strong> inside the <code>Calculator<\/code> class. No other class can directly access or modify these values. For example, this line of code would cause an error:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Calculator calc = new Calculator();\ncalc.a = 10; \/\/ Error: 'a' has private access in 'Calculator'<\/code><\/pre>\n\n\n\n<p>This is important for <strong>data protection<\/strong>. By making the variables private, you ensure that other parts of the program can\u2019t change the values of <code>a<\/code> and <code>b<\/code> unless you explicitly allow it through <strong>public methods<\/strong>. In your program, you provide public methods like <code>sum<\/code> and <code>subtract<\/code> that use the values of <code>a<\/code> and <code>b<\/code> indirectly. This is called <strong>encapsulation<\/strong>\u2014hiding the details but exposing the necessary functionality.<\/p>\n\n\n\n<p>If you ever need to allow access to <code>a<\/code> and <code>b<\/code> (but still keep control), you can create <strong>getter<\/strong> and <strong>setter<\/strong> methods like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public int getA() {\n    return a;\n}\n\npublic void setA(int value) {\n    this.a = value;\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Protected Modifier<\/strong><\/h3>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"640\" height=\"144\" src=\"https:\/\/i0.wp.com\/afzalbadshah.com\/wp-content\/uploads\/2024\/09\/OOP-Protected.drawio-1.png?resize=640%2C144&#038;ssl=1\" alt=\"\" class=\"wp-image-4091\" srcset=\"https:\/\/i0.wp.com\/afzalbadshah.com\/wp-content\/uploads\/2024\/09\/OOP-Protected.drawio-1.png?resize=1024%2C230&amp;ssl=1 1024w, https:\/\/i0.wp.com\/afzalbadshah.com\/wp-content\/uploads\/2024\/09\/OOP-Protected.drawio-1.png?resize=300%2C67&amp;ssl=1 300w, https:\/\/i0.wp.com\/afzalbadshah.com\/wp-content\/uploads\/2024\/09\/OOP-Protected.drawio-1.png?resize=768%2C172&amp;ssl=1 768w, https:\/\/i0.wp.com\/afzalbadshah.com\/wp-content\/uploads\/2024\/09\/OOP-Protected.drawio-1.png?resize=1536%2C345&amp;ssl=1 1536w, https:\/\/i0.wp.com\/afzalbadshah.com\/wp-content\/uploads\/2024\/09\/OOP-Protected.drawio-1.png?resize=604%2C136&amp;ssl=1 604w, https:\/\/i0.wp.com\/afzalbadshah.com\/wp-content\/uploads\/2024\/09\/OOP-Protected.drawio-1.png?w=1702&amp;ssl=1 1702w, https:\/\/i0.wp.com\/afzalbadshah.com\/wp-content\/uploads\/2024\/09\/OOP-Protected.drawio-1.png?w=1280&amp;ssl=1 1280w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/figure>\n\n\n\n<p>The <strong>protected<\/strong> modifier allows access to a variable or method within the same package and to <strong>subclasses<\/strong> (even if those subclasses are in different packages). This is especially useful in the context of <strong>inheritance<\/strong>.<\/p>\n\n\n\n<p> For example, if you have a class that extends <code>Calculator<\/code> and you want certain methods or variables to be accessible only to that subclass or classes in the same package, you would use the protected modifier:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public class Calculator {\r\n\r\n    \/\/ Attributes of the class\r\n    protected int a;\r\n    protected int b;\r\n\r\n    \/\/ Method for sum\r\n    protected int sum(int a, int b) {\r\n        return a + b;\r\n    }\r\n\r\n    \/\/ Method for subtraction\r\n    protected int subtract(int a, int b) {\r\n        return a - b;\r\n    }\r\n\r\n    \/\/ Method for multiplication\r\n    protected int multiply(int a, int b) {\r\n        return a * b;\r\n    }\r\n}\r\n\r\npublic class Calculator1 extends Calculator {\r\n\r\n    public void calculate() {\r\n        \/\/ Using the protected members from the Calculator class\r\n        this.a = 10; \/\/ setting value for a\r\n        this.b = 5;  \/\/ setting value for b\r\n        \r\n        System.out.println(\"Sum: \" + sum(a, b));\r\n        System.out.println(\"Subtract: \" + subtract(a, b));\r\n        System.out.println(\"Multiply: \" + multiply(a, b));\r\n    }\r\n\r\n    public static void main(String&#91;] args) {\r\n        Calculator1 calc = new Calculator1();\r\n        calc.calculate();\r\n    }\r\n}\r\n<\/code><\/pre>\n\n\n\n<p>This method can be accessed by classes in the same package or by any class that <strong>inherits<\/strong> from <code>Calculator<\/code>. However, it cannot be accessed from a completely unrelated class.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<ul class=\"wp-block-list\">\n<li><strong>Public<\/strong>: Allows access from <strong>anywhere<\/strong> in the program. In <code>Calculator<\/code> class, the class itself and the methods (<code>sum<\/code>, <code>subtract<\/code>, <code>multiply<\/code>) are public, so they can be accessed from any other class in your project.<\/li>\n\n\n\n<li><strong>Private<\/strong>: Limits access to <strong>only within the same class<\/strong>. The attributes <code>a<\/code> and <code>b<\/code> in <code>Calculator<\/code> class are private, meaning they cannot be accessed or modified directly from outside the class. You can, however, access them through public methods.<\/li>\n\n\n\n<li><strong>Protected<\/strong>: Primarily used in <strong>inheritance<\/strong> scenarios. It allows access within the same package or in subclasses, but not from completely unrelated classes. <\/li>\n<\/ul>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">Why are Access Modifiers Important?<\/h3>\n\n\n\n<p>Access modifiers help you <strong>organize and control<\/strong> the visibility of your code. In <code>Calculator<\/code> class, making the methods public allows other classes to perform operations like addition, subtraction, and multiplication, while keeping the variables <code>a<\/code> and <code>b<\/code> private ensures that no one can directly manipulate these values. This is called <strong>data encapsulation<\/strong>, which is a key principle of object-oriented programming.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Non-Access Modifiers <\/h2>\n\n\n\n<p>In addition to access modifiers like <strong>public<\/strong>, <strong>private<\/strong>, and <strong>protected<\/strong>, Java provides <strong>non-access modifiers<\/strong> that control other aspects of the behavior of classes, methods, and variables. Some common non-access modifiers are <strong>final<\/strong> and <strong>abstract<\/strong>. Let&#8217;s explore these with the <strong>Calculator<\/strong> example.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Final Modifier<\/strong><\/h3>\n\n\n\n<p>The <strong>final<\/strong> modifier in Java is used to restrict the modification of a class, method, or variable. Once something is declared as <code>final<\/code>, its value or definition cannot be changed.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Final Variable<\/strong><\/h4>\n\n\n\n<p>A <strong>final variable<\/strong> cannot be modified after it has been assigned a value. For example, if you wanted to define a constant in <code>Calculator<\/code> class (like a fixed value of <code>pi<\/code>), you would use the <code>final<\/code> modifier:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public class Calculator {\n    private final double pi = 3.14159;\n\n    \/\/ Other attributes and methods...\n}<\/code><\/pre>\n\n\n\n<p>In this case, <code>pi<\/code> is a <strong>constant<\/strong>. Once initialized, its value cannot be changed. If you try to modify it later in the program, Java will throw an error. This is helpful when you need to define values that <strong>should not change<\/strong> throughout the execution of your program.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Final Method<\/strong><\/h4>\n\n\n\n<p>A <strong>final method<\/strong> means that the method cannot be <strong>overridden<\/strong> by any subclass. For instance, if you want to make sure that the method <code>sum<\/code> in the <code>Calculator<\/code> class remains the same in any subclass, you can declare it as final:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public final int sum(int a, int b) {\n    return a + b;\n}<\/code><\/pre>\n\n\n\n<p>Now, if another class extends <code>Calculator<\/code>, it will <strong>not be allowed to change<\/strong> the behavior of the <code>sum<\/code> method. This is useful when you have a method that works perfectly and should not be modified in subclasses.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Final Class<\/strong><\/h4>\n\n\n\n<p>A <strong>final class<\/strong> means that no other class can extend or inherit from it. This prevents subclassing. If you want to ensure that no one can create a subclass of <code>Calculator<\/code>, you can declare the class as final:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public final class Calculator {\n    \/\/ Class content...\n}<\/code><\/pre>\n\n\n\n<p>Once you declare the class as final, it cannot be extended:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class AdvancedCalculator extends Calculator {\n    \/\/ Error: Cannot subclass a final class\n}<\/code><\/pre>\n\n\n\n<p>This is typically used when you want to make the class <strong>completely sealed<\/strong> and prevent further modification or extension.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Abstract Modifier<\/strong><\/h3>\n\n\n\n<p>The <strong>abstract<\/strong> modifier is used to create <strong>abstract classes and methods<\/strong>. An <strong>abstract class<\/strong> cannot be instantiated on its own, and an <strong>abstract method<\/strong> must be implemented by a subclass. This is useful when you are creating a base class that provides a general structure, but you want to leave some details to be defined in child classes.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Abstract Class<\/strong><\/h4>\n\n\n\n<p>An <strong>abstract class<\/strong> cannot be used to create objects. It can have both abstract and concrete (non-abstract) methods. If you want to create a base class for calculators that will later be extended by specific types of calculators (like scientific calculators or financial calculators), you can declare the class as abstract:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public abstract class Calculator {\n    \/\/ Abstract method\n    public abstract int divide(int a, int b);\n\n    \/\/ Concrete method\n    public int sum(int a, int b) {\n        return a + b;\n    }\n}<\/code><\/pre>\n\n\n\n<p>In this example, the <code>Calculator<\/code> class is abstract, meaning you <strong>cannot create an object of Calculator<\/strong> directly. Instead, you would need to create a subclass that provides the implementation of the <code>divide<\/code> method.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Abstract Method<\/strong><\/h4>\n\n\n\n<p>An <strong>abstract method<\/strong> is a method that has <strong>no body<\/strong> (no implementation) in the abstract class. Subclasses that extend the abstract class are required to <strong>provide an implementation<\/strong> for this method. In the example above, the method <code>divide<\/code> is abstract:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public abstract int divide(int a, int b);<\/code><\/pre>\n\n\n\n<p>Any subclass of <code>Calculator<\/code> must <strong>implement<\/strong> this method:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public class AdvancedCalculator extends Calculator {\n    @Override\n    public int divide(int a, int b) {\n        if (b != 0) {\n            return a \/ b;\n        } else {\n            throw new ArithmeticException(\"Cannot divide by zero\");\n        }\n    }\n}<\/code><\/pre>\n\n\n\n<p>In this case, the <code>AdvancedCalculator<\/code> class extends <code>Calculator<\/code> and <strong>provides the implementation<\/strong> for the <code>divide<\/code> method. This allows you to enforce that all calculators must have a <code>divide<\/code> method, but the <strong>details of how division works<\/strong> can vary between different types of calculators.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<ul class=\"wp-block-list\">\n<li><strong>Final<\/strong>: Used to prevent modification. A final variable cannot be changed, a final method cannot be overridden, and a final class cannot be extended.<\/li>\n\n\n\n<li><strong>Abstract<\/strong>: Used to create a blueprint for other classes. An abstract class cannot be instantiated directly, and abstract methods must be implemented by subclasses.<\/li>\n<\/ul>\n<\/blockquote>\n\n\n\n<p>By using non-access modifiers like <strong>final<\/strong> and <strong>abstract<\/strong>, you can create more <strong>secure<\/strong> and <strong>flexible<\/strong> Java programs. The <strong>final<\/strong> modifier helps protect critical parts of your code, while the <strong>abstract<\/strong> modifier allows you to build a base structure for other classes to follow, promoting reuse and maintainability.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><a href=\"https:\/\/www.canva.com\/design\/DAGRWwsmCGQ\/cb69iiM7yz_bEH3TagQzhg\/view?utm_content=DAGRWwsmCGQ&amp;utm_campaign=designshare&amp;utm_medium=link&amp;utm_source=editor\" target=\"_blank\" rel=\"noopener\" title=\"\">Visit the presentation here<\/a><\/td><\/tr><\/tbody><\/table><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Modifiers in Java are used to control the behaviour and accessibility of classes, methods, and variables. They define who can access certain parts of a program and how the components of the class behave. Modifiers are categorized into two main types: Access Modifiers and Non-Access Modifiers. Access modifiers determine the visibility of classes and their members, while non-access modifiers control aspects like immutability or the necessity of subclass implementation. Visit the detailed tutorial here. Access Modifiers In Java, access modifiers&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/afzalbadshah.com\/index.php\/2024\/09\/21\/understanding-modifiers-in-java\/\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":4083,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"enabled":false},"version":2}},"categories":[602],"tags":[619,621,622],"class_list":["post-4079","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-object-oriented-programing-oop","tag-access-modifiers","tag-modifiers","tag-private"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/afzalbadshah.com\/wp-content\/uploads\/2024\/09\/Access-Modifers-in-OOP-Java-jpg.webp?fit=1920%2C1080&ssl=1","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pf3emP-13N","jetpack-related-posts":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/afzalbadshah.com\/index.php\/wp-json\/wp\/v2\/posts\/4079","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afzalbadshah.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afzalbadshah.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afzalbadshah.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afzalbadshah.com\/index.php\/wp-json\/wp\/v2\/comments?post=4079"}],"version-history":[{"count":9,"href":"https:\/\/afzalbadshah.com\/index.php\/wp-json\/wp\/v2\/posts\/4079\/revisions"}],"predecessor-version":[{"id":4132,"href":"https:\/\/afzalbadshah.com\/index.php\/wp-json\/wp\/v2\/posts\/4079\/revisions\/4132"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/afzalbadshah.com\/index.php\/wp-json\/wp\/v2\/media\/4083"}],"wp:attachment":[{"href":"https:\/\/afzalbadshah.com\/index.php\/wp-json\/wp\/v2\/media?parent=4079"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afzalbadshah.com\/index.php\/wp-json\/wp\/v2\/categories?post=4079"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afzalbadshah.com\/index.php\/wp-json\/wp\/v2\/tags?post=4079"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}