{"id":5466,"date":"2023-10-23T17:48:24","date_gmt":"2023-10-24T00:48:24","guid":{"rendered":"https:\/\/ioflood.com\/blog\/?p=5466"},"modified":"2024-03-04T15:09:25","modified_gmt":"2024-03-04T22:09:25","slug":"java-final","status":"publish","type":"post","link":"https:\/\/ioflood.com\/blog\/java-final\/","title":{"rendered":"Java Final Keyword: A Detailed Exploration"},"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\/Stylized-lock-symbolizing-Java-final-keyword-with-code-and-logo-300x300.jpg\" alt=\"Stylized lock symbolizing Java final keyword with code and logo\" width=\"300\" height=\"300\" title=\"\"><\/figure>\n<\/div>\n<p>Are you finding the &#8216;final&#8217; keyword in Java a bit perplexing? You&#8217;re not alone. Many developers find themselves in a maze when it comes to understanding this particular keyword. Think of the &#8216;final&#8217; keyword as a security guard in Java, it locks down variables, methods, and classes, preventing any further changes.<\/p>\n<p><strong>This guide will help you understand and use the &#8216;final&#8217; keyword effectively in your Java programs.<\/strong> We&#8217;ll explore the core functionality of &#8216;final&#8217;, delve into its advanced uses, and even discuss common issues and their solutions.<\/p>\n<p>So, let&#8217;s dive in and start mastering the &#8216;final&#8217; keyword in Java!<\/p>\n<h2>TL;DR: What Does &#8216;final&#8217; Do in Java?<\/h2>\n<blockquote><p>\n  The <code>final<\/code> keyword in Java is used to make a variable constant, prevent a method from being overridden, or prevent a class from being inherited: <code>final int answerToEverything = 42<\/code> It&#8217;s a powerful tool that can help you control how your code behaves.\n<\/p><\/blockquote>\n<p>Here&#8217;s a simple example:<\/p>\n<pre><code class=\"language-java line-numbers\">final int MAX_SPEED = 120;\n<\/code><\/pre>\n<p>In this example, we declare a constant variable <code>MAX_SPEED<\/code> using the &#8216;final&#8217; keyword. This means that <code>MAX_SPEED<\/code> can&#8217;t be changed once it&#8217;s set to 120.<\/p>\n<blockquote><p>\n  This is just a basic use of &#8216;final&#8217; in Java, but there&#8217;s much more to learn about this keyword. Continue reading for more detailed information and advanced usage scenarios.\n<\/p><\/blockquote>\n<h2>Basic Use of &#8216;final&#8217; in Java<\/h2>\n<p>The &#8216;final&#8217; keyword in Java is a versatile tool, and its basic uses can be categorized into three main areas: variables, methods, and classes. Let&#8217;s explore each of these in detail.<\/p>\n<h3>&#8216;final&#8217; with Variables<\/h3>\n<p>When you declare a variable as &#8216;final&#8217;, it becomes a constant, meaning its value cannot be changed after it has been initialized. Here&#8217;s an example:<\/p>\n<pre><code class=\"language-java line-numbers\">final int MAX_AGE = 100;\n\/\/ MAX_AGE = 101; \/\/ This would throw an error\n\n\/\/ Output:\n\/\/ Error: cannot assign a value to final variable MAX_AGE\n<\/code><\/pre>\n<p>In this code, <code>MAX_AGE<\/code> is a &#8216;final&#8217; variable and is assigned a value of 100. Any attempt to change this value will result in a compile-time error.<\/p>\n<h3>&#8216;final&#8217; with Methods<\/h3>\n<p>When applied to methods, &#8216;final&#8217; prevents a method from being overridden in a subclass. This can be useful when you want a method to always behave in a specific way, regardless of any subclasses that extend the parent class. Here&#8217;s an example:<\/p>\n<pre><code class=\"language-java line-numbers\">class ParentClass {\n    final void show() {\n        System.out.println(\"This is a final method.\");\n    }\n}\n\nclass ChildClass extends ParentClass {\n    \/\/ Attempting to override show() would result in a compile-time error\n}\n\n\/\/ Output:\n\/\/ Error: show() in ChildClass cannot override show() in ParentClass\n\/\/ overridden method is final\n<\/code><\/pre>\n<h3>&#8216;final&#8217; with Classes<\/h3>\n<p>When a class is declared as &#8216;final&#8217;, it can&#8217;t be extended by any other class. This can be useful when you want to prevent a class from being subclassed. Here&#8217;s an example:<\/p>\n<pre><code class=\"language-java line-numbers\">final class FinalClass {\n    \/\/ Some methods and variables\n}\n\nclass SomeClass extends FinalClass { \/\/ This would throw an error\n    \/\/ Some methods and variables\n}\n\n\/\/ Output:\n\/\/ Error: cannot inherit from final FinalClass\n<\/code><\/pre>\n<p>In this code, <code>FinalClass<\/code> is declared as &#8216;final&#8217;, so attempting to create a subclass <code>SomeClass<\/code> results in a compile-time error.<\/p>\n<p>These are the basic uses of &#8216;final&#8217; in Java, but there&#8217;s much more to learn about this keyword. In the next section, we&#8217;ll explore some advanced uses of &#8216;final&#8217;.<\/p>\n<h2>Advanced Use of &#8216;final&#8217; in Java<\/h2>\n<p>As you become more comfortable with the &#8216;final&#8217; keyword, you can start to explore its more sophisticated applications. Let&#8217;s delve into using &#8216;final&#8217; with arrays, parameters, and anonymous classes.<\/p>\n<h3>&#8216;final&#8217; with Arrays<\/h3>\n<p>When you declare an array as &#8216;final&#8217;, it means you can&#8217;t change its reference to point to another array. However, you can modify its elements. Here&#8217;s an example:<\/p>\n<pre><code class=\"language-java line-numbers\">final int[] FINAL_ARRAY = new int[]{1, 2, 3};\nFINAL_ARRAY[0] = 10; \/\/ This is allowed\n\/\/ FINAL_ARRAY = new int[]{4, 5, 6}; \/\/ This would throw an error\n\n\/\/ Output:\n\/\/ Error: cannot assign a value to final variable FINAL_ARRAY\n<\/code><\/pre>\n<p>In this code, <code>FINAL_ARRAY<\/code> is a &#8216;final&#8217; array. You can modify its elements, as shown by setting <code>FINAL_ARRAY[0]<\/code> to 10. However, you can&#8217;t make <code>FINAL_ARRAY<\/code> point to a different array.<\/p>\n<h3>&#8216;final&#8217; with Parameters<\/h3>\n<p>&#8216;final&#8217; parameters are parameters declared as &#8216;final&#8217;. A &#8216;final&#8217; parameter&#8217;s value can&#8217;t be changed within the method. This can be useful when you want to ensure that a passed parameter isn&#8217;t altered. Here&#8217;s an example:<\/p>\n<pre><code class=\"language-java line-numbers\">void show(final int NUM) {\n    \/\/ NUM = 10; \/\/ This would throw an error\n}\n\n\/\/ Output:\n\/\/ Error: cannot assign a value to final variable NUM\n<\/code><\/pre>\n<p>In this code, <code>NUM<\/code> is a &#8216;final&#8217; parameter in the <code>show<\/code> method. Any attempt to change its value within the method results in a compile-time error.<\/p>\n<h3>&#8216;final&#8217; with Anonymous Classes<\/h3>\n<p>In anonymous classes, variables from the enclosing scope must be declared &#8216;final&#8217; to be accessed. Here&#8217;s an example:<\/p>\n<pre><code class=\"language-java line-numbers\">int num = 10;\nRunnable r = new Runnable() {\n    public void run() {\n        \/\/ System.out.println(num); \/\/ This would throw an error\n    }\n};\n\n\/\/ Output:\n\/\/ Error: local variables referenced from an inner class must be final or effectively final\n<\/code><\/pre>\n<p>In this code, <code>num<\/code> is a variable in the scope of the anonymous class <code>Runnable<\/code>. To access <code>num<\/code> within the <code>run<\/code> method, <code>num<\/code> must be declared as &#8216;final&#8217;.<\/p>\n<p>These advanced uses of &#8216;final&#8217; can provide more control and precision in your Java coding. In the next section, we&#8217;ll explore alternative approaches to using &#8216;final&#8217;.<\/p>\n<h2>Alternatives to &#8216;final&#8217; in Java<\/h2>\n<p>While &#8216;final&#8217; is a powerful tool in Java, there are alternative approaches to achieve similar results. These alternatives can be particularly useful in certain scenarios. Let&#8217;s explore using private methods and composition as alternatives to &#8216;final&#8217;.<\/p>\n<h3>Private Methods as an Alternative<\/h3>\n<p>One way to prevent a method from being overridden, similar to using &#8216;final&#8217;, is to declare it as private. Private methods are not visible to subclasses and thus cannot be overridden.<\/p>\n<pre><code class=\"language-java line-numbers\">class ParentClass {\n    private void show() {\n        System.out.println(\"This is a private method.\");\n    }\n}\n\nclass ChildClass extends ParentClass {\n    \/\/ Attempting to override show() would result in a compile-time error\n}\n\n\/\/ Output:\n\/\/ Error: show() has private access in ParentClass\n<\/code><\/pre>\n<p>In this example, the <code>show()<\/code> method is private, so it cannot be overridden in <code>ChildClass<\/code>. However, using private methods limits the method&#8217;s visibility, which may not be desirable in all scenarios.<\/p>\n<h3>Composition Over Inheritance<\/h3>\n<p>Another alternative to using &#8216;final&#8217; with classes is to use composition over inheritance. This design principle suggests using composition (combining simple objects to create more complex ones) instead of inheritance to achieve code reuse and flexibility.<\/p>\n<pre><code class=\"language-java line-numbers\">class Engine {\n    void start() {\n        System.out.println(\"Engine started.\");\n    }\n}\n\nclass Car {\n    private Engine engine = new Engine();\n\n    void startEngine() {\n        engine.start();\n    }\n}\n<\/code><\/pre>\n<p>In this example, instead of <code>Car<\/code> inheriting from <code>Engine<\/code>, <code>Car<\/code> has an <code>Engine<\/code>. This allows <code>Car<\/code> to control access to the <code>Engine<\/code>&#8216;s methods and prevents the <code>Engine<\/code> class from being subclassed.<\/p>\n<p>While these alternatives can achieve similar results to using &#8216;final&#8217;, they have their own benefits and drawbacks. Understanding these can help you make more informed decisions when designing your Java programs.<\/p>\n<h2>Troubleshooting &#8216;final&#8217; in Java<\/h2>\n<p>While &#8216;final&#8217; is a powerful keyword in Java, it&#8217;s not without its complexities. Let&#8217;s explore some common issues and their solutions when using &#8216;final&#8217;.<\/p>\n<h3>Uninitialized &#8216;final&#8217; Variables<\/h3>\n<p>One common error is declaring a &#8216;final&#8217; variable without initializing it. &#8216;final&#8217; variables must be initialized at the time of declaration.<\/p>\n<pre><code class=\"language-java line-numbers\">final int MAX_AGE;\n\/\/ This would throw an error\n\n\/\/ Output:\n\/\/ Error: variable MAX_AGE might not have been initialized\n<\/code><\/pre>\n<p>In this code, <code>MAX_AGE<\/code> is a &#8216;final&#8217; variable that is not initialized, resulting in a compile-time error. To fix this, you should initialize <code>MAX_AGE<\/code> at the time of declaration.<\/p>\n<h3>Overriding &#8216;final&#8217; Methods<\/h3>\n<p>Another common error is attempting to override a &#8216;final&#8217; method. &#8216;final&#8217; methods can&#8217;t be overridden.<\/p>\n<pre><code class=\"language-java line-numbers\">class ParentClass {\n    final void show() {\n        System.out.println(\"This is a final method.\");\n    }\n}\n\nclass ChildClass extends ParentClass {\n    void show() { \/\/ This would throw an error\n        System.out.println(\"This is a child method.\");\n    }\n}\n\n\/\/ Output:\n\/\/ Error: show() in ChildClass cannot override show() in ParentClass\n\/\/ overridden method is final\n<\/code><\/pre>\n<p>In this code, <code>show()<\/code> in <code>ChildClass<\/code> attempts to override the &#8216;final&#8217; method <code>show()<\/code> in <code>ParentClass<\/code>, resulting in a compile-time error. To fix this, you should remove the &#8216;final&#8217; keyword from the method in the parent class if you want it to be overridden.<\/p>\n<h3>Extending &#8216;final&#8217; Classes<\/h3>\n<p>A &#8216;final&#8217; class can&#8217;t be extended. Attempting to do so will result in a compile-time error.<\/p>\n<pre><code class=\"language-java line-numbers\">final class FinalClass {\n    \/\/ Some methods and variables\n}\n\nclass SomeClass extends FinalClass { \/\/ This would throw an error\n    \/\/ Some methods and variables\n}\n\n\/\/ Output:\n\/\/ Error: cannot inherit from final FinalClass\n<\/code><\/pre>\n<p>In this code, <code>SomeClass<\/code> attempts to extend the &#8216;final&#8217; class <code>FinalClass<\/code>, resulting in a compile-time error. To fix this, you should remove the &#8216;final&#8217; keyword from the class definition if you want it to be extended.<\/p>\n<p>Remember, understanding these common issues and their solutions can help you use the &#8216;final&#8217; keyword more effectively in your Java programs.<\/p>\n<h2>Java&#8217;s Object-Oriented Principles and &#8216;final&#8217;<\/h2>\n<p>To fully understand the power and utility of the &#8216;final&#8217; keyword, it&#8217;s crucial to grasp Java&#8217;s fundamental object-oriented principles. These principles include inheritance, encapsulation, and polymorphism, all of which interact with &#8216;final&#8217; in different ways.<\/p>\n<h3>Inheritance and &#8216;final&#8217;<\/h3>\n<p>Inheritance allows a new class to inherit the members (fields and methods) of an existing class. The &#8216;final&#8217; keyword can restrict this inheritance. When a class is declared as &#8216;final&#8217;, it can&#8217;t be extended. Similarly, a &#8216;final&#8217; method can&#8217;t be overridden by subclasses.<\/p>\n<pre><code class=\"language-java line-numbers\">final class FinalClass {\n    \/\/ Some methods and variables\n}\n\nclass SomeClass extends FinalClass { \/\/ This would throw an error\n    \/\/ Some methods and variables\n}\n\n\/\/ Output:\n\/\/ Error: cannot inherit from final FinalClass\n<\/code><\/pre>\n<p>In this example, <code>SomeClass<\/code> attempts to extend the &#8216;final&#8217; class <code>FinalClass<\/code>, resulting in a compile-time error.<\/p>\n<h3>Encapsulation and &#8216;final&#8217;<\/h3>\n<p>Encapsulation is the technique of making the fields in a class private and providing access to the fields via public methods. If a field is declared public, it can be accessed from anywhere. &#8216;final&#8217; variables can be used to create constants that are accessible but not modifiable.<\/p>\n<pre><code class=\"language-java line-numbers\">public final int MAX_SPEED = 120;\n\/\/ MAX_SPEED can be accessed but not modified\n<\/code><\/pre>\n<p>In this code, <code>MAX_SPEED<\/code> is a &#8216;final&#8217; variable that can be accessed from any class, but its value can&#8217;t be changed.<\/p>\n<h3>Polymorphism and &#8216;final&#8217;<\/h3>\n<p>Polymorphism allows a subclass to behave as its superclass. This is typically achieved by overriding methods in the superclass. However, &#8216;final&#8217; methods can&#8217;t be overridden, which restricts polymorphism.<\/p>\n<pre><code class=\"language-java line-numbers\">class ParentClass {\n    final void show() {\n        System.out.println(\"This is a final method.\");\n    }\n}\n\nclass ChildClass extends ParentClass {\n    void show() { \/\/ This would throw an error\n        System.out.println(\"This is a child method.\");\n    }\n}\n\n\/\/ Output:\n\/\/ Error: show() in ChildClass cannot override show() in ParentClass\n\/\/ overridden method is final\n<\/code><\/pre>\n<p>In this example, <code>show()<\/code> in <code>ChildClass<\/code> attempts to override the &#8216;final&#8217; method <code>show()<\/code> in <code>ParentClass<\/code>, resulting in a compile-time error.<\/p>\n<p>In conclusion, the &#8216;final&#8217; keyword plays a significant role in Java&#8217;s object-oriented principles. By understanding these principles, you can use &#8216;final&#8217; more effectively in your Java programs.<\/p>\n<h2>Exploring &#8216;final&#8217; in Larger Java Projects<\/h2>\n<p>The &#8216;final&#8217; keyword isn&#8217;t just for small programs or simple scripts. It plays an integral role in larger Java projects as well, providing control and ensuring consistency in your codebase. Let&#8217;s delve into its application in broader contexts.<\/p>\n<h3>&#8216;final&#8217; and Immutable Classes<\/h3>\n<p>Immutable classes, once created, cannot be changed. They provide several benefits such as simplicity of use, thread safety, and potential performance enhancements. The &#8216;final&#8217; keyword is essential in creating immutable classes in Java, as it prevents the alteration of field values once they&#8217;re set.<\/p>\n<pre><code class=\"language-java line-numbers\">public final class ImmutableClass {\n    final private int value;\n\n    public ImmutableClass(int value) {\n        this.value = value;\n    }\n\n    public int getValue() {\n        return value;\n    }\n}\n<\/code><\/pre>\n<p>In this example, <code>ImmutableClass<\/code> is an immutable class with a &#8216;final&#8217; field <code>value<\/code>. The field can only be set once during object creation and cannot be changed afterwards.<\/p>\n<h3>&#8216;final&#8217; in Design Patterns<\/h3>\n<p>Design patterns represent solutions to common problems in software design. They can be classified into creational, structural, and behavioral patterns. The &#8216;final&#8217; keyword often features in these patterns, such as the Singleton pattern, where a &#8216;final&#8217; instance ensures only one instance of the class exists.<\/p>\n<pre><code class=\"language-java line-numbers\">public class Singleton {\n    private static final Singleton INSTANCE = new Singleton();\n\n    private Singleton() {}\n\n    public static Singleton getInstance() {\n        return INSTANCE;\n    }\n}\n<\/code><\/pre>\n<p>In this example, <code>INSTANCE<\/code> is a &#8216;final&#8217; variable in the <code>Singleton<\/code> class. It ensures there&#8217;s only one <code>Singleton<\/code> instance throughout the application.<\/p>\n<h3>&#8216;final&#8217; and Concurrency<\/h3>\n<p>Concurrency in Java involves executing multiple threads simultaneously. The &#8216;final&#8217; keyword plays a crucial role in ensuring thread-safety, as &#8216;final&#8217; variables are safe from data races.<\/p>\n<pre><code class=\"language-java line-numbers\">public class ThreadSafeClass {\n    private final int safeValue;\n\n    public ThreadSafeClass(int value) {\n        this.safeValue = value;\n    }\n\n    public int getSafeValue() {\n        return safeValue;\n    }\n}\n<\/code><\/pre>\n<p>In this example, <code>safeValue<\/code> is a &#8216;final&#8217; variable in the <code>ThreadSafeClass<\/code> class. It ensures that the value is thread-safe and won&#8217;t be changed by multiple threads simultaneously.<\/p>\n<h3>Further Resources for Mastering &#8216;final&#8217; in Java<\/h3>\n<p>To continue your learning journey with the &#8216;final&#8217; keyword in Java, check out these resources:<\/p>\n<ul>\n<li><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/ioflood.com\/blog\/variables-in-java\/\">Mastering Variables in Java: Essential Concepts<\/a> &#8211; Understand Java variables easily with clear explanations.<\/p>\n<\/li>\n<li>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/ioflood.com\/blog\/access-modifiers-in-java\/\">Access Modifiers in Java<\/a> &#8211; Understand using access modifiers in Java for controlling the accessibility of class members.<\/p>\n<\/li>\n<li>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/ioflood.com\/blog\/length-java\/\">Array Length in Java<\/a> &#8211; Explore how to use .length in Java to retrieve the size of arrays and strings.<\/p>\n<\/li>\n<li>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/docs.oracle.com\/javase\/tutorial\/java\/IandI\/final.html\" target=\"_blank\" rel=\"noopener\">Oracle&#8217;s Java Tutorials<\/a> provide in-depth information about the &#8216;final&#8217; keyword.<\/p>\n<\/li>\n<li>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/www.javatpoint.com\/final-keyword\" target=\"_blank\" rel=\"noopener\">Final Keyword in Java<\/a> by JavaTPoint provides a detailed exploration of the &#8216;final&#8217; keyword in Java.<\/p>\n<\/li>\n<li>\n<p>GeeksforGeeks&#8217; <a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/www.geeksforgeeks.org\/final-keyword-java\/\" target=\"_blank\" rel=\"noopener\">&#8216;final&#8217; keyword guide<\/a> offers a comprehensive look at &#8216;final&#8217;, complete with examples and explanations.<\/p>\n<\/li>\n<\/ul>\n<h2>Wrapping Up: Mastering &#8216;final&#8217; in Java<\/h2>\n<p>In this comprehensive guide, we&#8217;ve navigated the intricacies of the &#8216;final&#8217; keyword in Java, a powerful tool for controlling the behavior of your code.<\/p>\n<p>We started with the basics, learning how to use &#8216;final&#8217; with variables, methods, and classes. We then dived deeper, exploring more complex uses of &#8216;final&#8217; with arrays, parameters, and anonymous classes. We also discussed alternative approaches, such as using private methods or composition instead of inheritance, to achieve similar results without using &#8216;final&#8217;.<\/p>\n<p>Along the way, we tackled common challenges you might encounter when using &#8216;final&#8217;, such as uninitialized &#8216;final&#8217; variables, overriding &#8216;final&#8217; methods, and extending &#8216;final&#8217; classes, providing you with solutions and workarounds for each issue.<\/p>\n<p>We also looked at how &#8216;final&#8217; interacts with Java&#8217;s fundamental object-oriented principles, such as inheritance, encapsulation, and polymorphism. Finally, we explored the use of &#8216;final&#8217; in larger Java projects, discussing its role in creating immutable classes, implementing design patterns, and ensuring thread safety in concurrent programming.<\/p>\n<p>Here&#8217;s a quick comparison of the methods we&#8217;ve discussed:<\/p>\n<table>\n<thead>\n<tr>\n<th>Method<\/th>\n<th>Pros<\/th>\n<th>Cons<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>&#8216;final&#8217; with Variables<\/td>\n<td>Creates constant variables<\/td>\n<td>Requires initialization at declaration<\/td>\n<\/tr>\n<tr>\n<td>&#8216;final&#8217; with Methods<\/td>\n<td>Prevents method overriding<\/td>\n<td>Limits flexibility in subclasses<\/td>\n<\/tr>\n<tr>\n<td>&#8216;final&#8217; with Classes<\/td>\n<td>Prevents class extension<\/td>\n<td>Limits code reuse through inheritance<\/td>\n<\/tr>\n<tr>\n<td>Private Methods<\/td>\n<td>Prevents method overriding<\/td>\n<td>Limits method visibility<\/td>\n<\/tr>\n<tr>\n<td>Composition Over Inheritance<\/td>\n<td>Provides code reuse and flexibility<\/td>\n<td>More complex than inheritance<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Whether you&#8217;re just starting out with &#8216;final&#8217; in Java or you&#8217;re looking to deepen your understanding, we hope this guide has given you a comprehensive overview of the &#8216;final&#8217; keyword and its applications.<\/p>\n<p>With its ability to control the behavior of variables, methods, and classes, &#8216;final&#8217; is a key tool in any Java developer&#8217;s toolbox. Happy coding!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Are you finding the &#8216;final&#8217; keyword in Java a bit perplexing? You&#8217;re not alone. Many developers find themselves in a maze when it comes to understanding this particular keyword. Think of the &#8216;final&#8217; keyword as a security guard in Java, it locks down variables, methods, and classes, preventing any further changes. This guide will help [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":10275,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[154,121],"tags":[],"class_list":["post-5466","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\/5466","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=5466"}],"version-history":[{"count":9,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts\/5466\/revisions"}],"predecessor-version":[{"id":17965,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts\/5466\/revisions\/17965"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/media\/10275"}],"wp:attachment":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/media?parent=5466"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/categories?post=5466"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/tags?post=5466"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}