{"id":25536018,"date":"2022-07-30T00:39:45","date_gmt":"2022-07-29T19:09:45","guid":{"rendered":"https:\/\/entri.app\/blog\/?p=25536018"},"modified":"2022-11-23T15:10:26","modified_gmt":"2022-11-23T09:40:26","slug":"what-is-encapsulation-in-java-and-how-to-implement-it","status":"publish","type":"post","link":"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/","title":{"rendered":"What is Encapsulation in Java and How to Implement It"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_79_2 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69e102e9bad40\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69e102e9bad40\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/#What_is_Encapsulation_in_Java\" >What is Encapsulation in Java?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/#Need_for_Encapsulation_in_Java\" >Need for Encapsulation in Java<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/#Data_Hiding_in_Java\" >Data Hiding in Java<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/#Data_Hiding_vs_Encapsulation_in_Java\" >Data Hiding vs. Encapsulation in Java<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/#Getter_and_Setter_Methods\" >Getter and Setter Methods<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/#Benefits_of_Encapsulation_in_Java\" >Benefits of Encapsulation in Java<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/#Java_Encapsulation_Example_Using_Getter-Setter\" >Java Encapsulation Example: Using Getter-Setter<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/#Advantages_of_Encapsulation_in_java\" >Advantages of Encapsulation in java<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<div class=\"detail-banner article-banner-details videoDetail\">\n<div class=\"article-info test-class\"><\/div>\n<\/div>\n<div class=\"video-sticky-wrap\">\n<div class=\"detail-banner article-banner-details videoDetail video-sticky-cls\">\n<div id=\"embeddedYTVideo\">\n<div class=\"video-banner\"><\/div>\n<\/div>\n<\/div>\n<div class=\"info-details video-info\">\n<div id=\"articleLongDescription\" class=\"tutorialContent\">\n<article class=\"desig_author empty-text\">Encapsulation in Java is a powerful mechanism for storing the data members and data methods of a class together. It is done in the form of a secure field accessible by only the members of the same class.<\/article>\n<article class=\"desig_author empty-text\">\n<h2 id=\"what_is_encapsulation_in_java\"><a href=\"https:\/\/bit.ly\/3ELmCiA\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-25522670 size-full\" src=\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Rectangle-1.png\" alt=\"Python and Machine Learning Rectangle\" width=\"970\" height=\"250\" srcset=\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Rectangle-1.png 970w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Rectangle-1-300x77.png 300w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Rectangle-1-768x198.png 768w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Rectangle-1-750x193.png 750w\" sizes=\"auto, (max-width: 970px) 100vw, 970px\" \/><\/a><\/h2>\n<p style=\"text-align: center;\"><strong><a href=\"https:\/\/bit.ly\/3ELmCiA\" target=\"_blank\" rel=\"noopener\">Grab the opportunity to learn Python with Entri! Click Here<\/a><\/strong><\/p>\n<h2><span class=\"ez-toc-section\" id=\"What_is_Encapsulation_in_Java\"><\/span><strong>What is Encapsulation in Java?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Encapsulation in Java refers to integrating data (variables) and code (methods) into a single unit. In encapsulation, a class&#8217;s variables are hidden from other classes and can only be accessed by the methods of the class in which they are found.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"blend-mode\" src=\"https:\/\/www.simplilearn.com\/ice9\/free_resources_article_thumb\/Encapsulation_in_Java.png\" alt=\"java\" width=\"1211\" height=\"717\" \/><\/p>\n<p>Encapsulation in Java is an object-oriented procedure of combining the data members and data methods of the class inside the user-defined class. It is important to declare this class as private.<\/p>\n<p>Next, we will understand the Syntax to be followed while implementing encapsulation in Java.<\/p>\n<p>Syntax:<\/p>\n<p>&lt;Access_Modifier&gt; class &lt;Class_Name&gt; {<\/p>\n<p>private &lt;Data_Members&gt;;<\/p>\n<p>private &lt;Data_Methods&gt;;<\/p>\n<p>}<\/p>\n<p>For enhancing the understanding of the encapsulation process, let us go through the following sample program.<\/p>\n<p>Example:<\/p>\n<p>package dc;<\/p>\n<p>public class c<\/p>\n<p>{<\/p>\n<p>public static void main (String[] args)<\/p>\n<p>{<\/p>\n<p>Employee e = new Employee();<\/p>\n<p>e.setName(&#8220;Robert&#8221;);<\/p>\n<p>e.setAge(33);<\/p>\n<p>e.setEmpID(1253);<\/p>\n<p>System.out.println(&#8220;Employee&#8217;s name: &#8221; + e.getName());<\/p>\n<p>System.out.println(&#8220;Employee&#8217;s age: &#8221; + e.getAge());<\/p>\n<p>System.out.println(&#8220;Employee&#8217;s ID: &#8221; + e.getEmpID());<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>package dc;<\/p>\n<p>public class Employee {<\/p>\n<p>private String Name;<\/p>\n<p>private int EmpID;<\/p>\n<p>private int Age;<\/p>\n<p>public int getAge() {<\/p>\n<p>return Age;<\/p>\n<p>}<\/p>\n<p>public String getName() {<\/p>\n<p>return Name;<\/p>\n<p>}<\/p>\n<p>public int getEmpID() {<\/p>\n<p>return EmpID;<\/p>\n<p>}<\/p>\n<p>public void setAge(int newAge) {<\/p>\n<p>Age = newAge;<\/p>\n<p>}<\/p>\n<p>public void setName(String newName) {<\/p>\n<p>Name = newName;<\/p>\n<p>}<\/p>\n<p>public void setRoll(int newEmpID) {<\/p>\n<p>EmpID = newEmpID;<\/p>\n<p>}<\/p>\n<p>public void setEmpID(int EmpID) {<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>\/\/<\/p>\n<p>Output:<\/p>\n<p>Employee&#8217;s name: Robert<\/p>\n<p>Employee&#8217;s age: 33<\/p>\n<p>Employee&#8217;s ID: 1253<\/p>\n<\/article>\n<article class=\"desig_author empty-text\">\n<h2 id=\"need_for_encapsulation_in_java\"><span class=\"ez-toc-section\" id=\"Need_for_Encapsulation_in_Java\"><\/span><strong>Need for Encapsulation in Java<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Encapsulation improvises the procedure of coding to a whole new level. We need encapsulation in Java for various reasons. They are stated below.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"blend-mode\" src=\"https:\/\/www.simplilearn.com\/ice9\/free_resources_article_thumb\/why_we_need_encapsulation-Encapsulation_in_Java.png\" alt=\"Encapsulation\" width=\"1041\" height=\"602\" \/><\/p>\n<h3>Better Control<\/h3>\n<p>Encapsulation provides ultimate control over the data members and data methods inside the class.<\/p>\n<h3>Getter and Setter<\/h3>\n<p>The standard IDEs provide in-built support for \u2018Getter and Setter\u2019 methods, which increases the programming pace.<\/p>\n<h3>Security<\/h3>\n<p>Encapsulation prevents access to data members and data methods by any external classes. The encapsulation process improves the security of the encapsulated data.<\/p>\n<h3>Flexibility<\/h3>\n<p>Changes made to one part of the code can be successfully implemented without affecting any other part of the code.<\/p>\n<\/article>\n<article class=\"desig_author empty-text\">\n<h2 id=\"data_hiding_in_java\"><span class=\"ez-toc-section\" id=\"Data_Hiding_in_Java\"><\/span><strong>Data Hiding in Java<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Data hiding is a procedure done to avoid access to the data members and data methods and their logical implementation. Data hiding can be done by using the access specifiers. We have four access specifiers, which are as follows.<\/p>\n<p><img decoding=\"async\" class=\"blend-mode\" src=\"https:\/\/www.simplilearn.com\/ice9\/free_resources_article_thumb\/Acess_Modifiers-Encapsulation_in_Java.png\" alt=\"\" \/><\/p>\n<h3><strong>Default<\/strong><\/h3>\n<p>Default is the first line of data hiding. If any class in Java is not mentioned with an access specifier, then the compiler will set \u2018default\u2019 as the access specifier. The access specifications of default are extremely similar to that of the public access specifier.<\/p>\n<h3><strong>Public<\/strong><\/h3>\n<p>The public access specifier provides the access specifications to a class so that it can be accessed from anywhere within the program.<\/p>\n<p>Example:<\/p>\n<p>package Simplilearn;<\/p>\n<p>class vehicle {<\/p>\n<p>public int tires;<\/p>\n<p>public void display() {<\/p>\n<p>System.out.println(&#8220;I have a vehicle.&#8221;);<\/p>\n<p>System.out.println(&#8220;It has &#8221; + tires + &#8221; tires.&#8221;);<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>public class Display {<\/p>\n<p>public static void main(String[] args) {<\/p>\n<p>vehicle veh = new vehicle();<\/p>\n<p>veh.tires = 4;<\/p>\n<p>veh.display();<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>\/\/Output:<\/p>\n<p>I have a vehicle.<\/p>\n<p>It has four tires.<\/p>\n<h3><strong>Private<\/strong><\/h3>\n<p>The private access specifier provides access to the data members, and the data methods limit to the class itself.<\/p>\n<p>Example:<\/p>\n<p>package Simplilearn;<\/p>\n<p>class Student {<\/p>\n<p>private int rank;<\/p>\n<p>public int getRank() {<\/p>\n<p>return rank;<\/p>\n<p>}<\/p>\n<p>public void setRank(int rank) {<\/p>\n<p>this.rank = rank;<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>public class school {<\/p>\n<p>public static void main(String[] args) {<\/p>\n<p>Student s = new Student();<\/p>\n<p>s.setRank(1022);<\/p>\n<p>System.out.println(&#8220;Student rank is &#8221; + s.getRank());<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>\/\/Output:<\/p>\n<p>Student rank is 1022<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/bit.ly\/3ELmCiA\" target=\"_blank\" rel=\"noopener\"><strong>Learn to code from industry experts! Enroll here<\/strong><\/a><\/p>\n<h3><strong>Protected<\/strong><\/h3>\n<p>The protected access specifier protects the class methods and members similar to the private access specifier. The main difference is that the access is limited to the entire package, unlike only a class with the private access specifier.<\/p>\n<p>Example:<\/p>\n<p>package Simplilearn;<\/p>\n<p>class human {<\/p>\n<p>protected String stream;<\/p>\n<p>protected void display() {<\/p>\n<p>System.out.println(&#8220;Hello, I am a &#8221; + stream + &#8221; Student&#8221;);<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>public class Student extends human {<\/p>\n<p>public static void main(String[] args) {<\/p>\n<p>Student s = new Student();<\/p>\n<p>s.stream = &#8220;Computer Science and Engineering Technology&#8221;;<\/p>\n<p>s.display();<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>\/\/Output:<\/p>\n<p>Hello, I am a Computer Science and Engineering Technology Student<\/p>\n<h2 id=\"data_hiding_vs_encapsulation_in_java\"><span class=\"ez-toc-section\" id=\"Data_Hiding_vs_Encapsulation_in_Java\"><\/span><strong>Data Hiding vs. Encapsulation in Java<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<table>\n<tbody>\n<tr>\n<td>Data Hiding<\/td>\n<td>Data Encapsulation<\/td>\n<\/tr>\n<tr>\n<td>Data hiding can be considered as the parent process<\/td>\n<td>Encapsulation is a sub-process of data hiding<\/td>\n<\/tr>\n<tr>\n<td>Access specifier is always private<\/td>\n<td>Access specifier can be private and public<\/td>\n<\/tr>\n<tr>\n<td>Data hiding is about hiding method implementation<\/td>\n<td>Encapsulation is about combining methods with data members<\/td>\n<\/tr>\n<tr>\n<td>The main motto is to hide data and its implementation<\/td>\n<td>The main motto is to combine data and their methods<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 id=\"getter_and_setter_methods\"><span class=\"ez-toc-section\" id=\"Getter_and_Setter_Methods\"><\/span><strong>Getter and Setter Methods<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Getter and setter techniques are commonly referred to in object-oriented programming languages. An attribute can be retrieved using a getter method, and it can also be changed using a setter method, as indicated by the names. Your implementation methods will determine if an attribute may be read and updated. Additionally, you may choose whether or not the attribute is read-only or wholly hidden from view.<\/p>\n<h3><strong>Example 1<\/strong><\/h3>\n<p>Following is an example of encapsulation in java &#8211;<\/p>\n<p>\/* File name : EncapTest.java *\/<\/p>\n<p>public class EncapTest {<\/p>\n<p>private String name;<\/p>\n<p>private String idNum;<\/p>\n<p>private int age;<\/p>\n<p>public int getAge() {<\/p>\n<p>return age;<\/p>\n<p>}<\/p>\n<p>public String getName() {<\/p>\n<p>return name;<\/p>\n<p>}<\/p>\n<p>public String getIdNum() {<\/p>\n<p>return idNum;<\/p>\n<p>}<\/p>\n<p>public void setAge( int newAge) {<\/p>\n<p>age = newAge;<\/p>\n<p>}<\/p>\n<p>public void setName(String newName) {<\/p>\n<p>name = newName;<\/p>\n<p>}<\/p>\n<p>public void setIdNum( String newId) {<\/p>\n<p>idNum = newId;<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>The public setXXX() and getXXX() methods provide access to the EncapTest class&#8217;s instance variables.<\/p>\n<p>The terms &#8220;getters&#8221; and &#8220;setters&#8221; are often used to describe these techniques. As a result, every class that needs to access the variables should use these getters and setters.<\/p>\n<p>The variables of the encap test class can be accessed using the following program \u2013<\/p>\n<p>\/* File name : RunEncap.java *\/<\/p>\n<p>public class RunEncap {<\/p>\n<p>public static void main(String args[]) {<\/p>\n<p>EncapTest encap = new EncapTest();<\/p>\n<p>encap.setName(&#8220;James&#8221;);<\/p>\n<p>encap.setAge(20);<\/p>\n<p>encap.setIdNum(&#8220;12343ms&#8221;);<\/p>\n<p>System.out.print(&#8220;Name : &#8221; + encap.getName() + &#8221; Age : &#8221; + encap.getAge());<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>It will result in the following outcome:<\/p>\n<h4>Output:<\/h4>\n<p>Name: James Age: 20<\/p>\n<h3><strong>The CoffeeMachine Example<\/strong><\/h3>\n<p>Encapsulation, or &#8220;Information Hiding,&#8221; refers to the practice of concealing the details of an object&#8217;s internal processes. It&#8217;s nothing more than a simple data masking technique.<\/p>\n<p>When the CoffeeMachine class was developed, the encapsulation method was implemented. The current state of the CoffeeMachine object is recorded in the attributes configMap, beans, grinder, and brewingUnit.<\/p>\n<p>The methods brewCoffee, brewEspresso, brewFilterCoffee, and addBeans are available to perform various operations on these properties.<\/p>\n<h4>Code:<\/h4>\n<p>import java.util.HashMap;<\/p>\n<p>import java.util.Map;<\/p>\n<p>public class CoffeeMachine {<\/p>\n<p>private Map configMap;<\/p>\n<p>private Map beans;<\/p>\n<p>private Grinder grinder;<\/p>\n<p>private BrewingUnit brewingUnit;<\/p>\n<p>public CoffeeMachine(Map beans) {<\/p>\n<p>this.beans = beans;<\/p>\n<p>this.grinder = new Grinder();<\/p>\n<p>this.brewingUnit = new BrewingUnit();<\/p>\n<p>this.configMap = new HashMap();<\/p>\n<p>this.configMap.put(CoffeeSelection.ESPRESSO, new Configuration(8, 28));<\/p>\n<p>this.configMap.put(CoffeeSelection.FILTER_COFFEE, new Configuration(30, 480));<\/p>\n<p>}<\/p>\n<p>public Coffee brewCoffee(CoffeeSelection selection) throws CoffeeException {<\/p>\n<p>switch (selection) {<\/p>\n<p>case FILTER_COFFEE:<\/p>\n<p>return brewFilterCoffee();<\/p>\n<p>case ESPRESSO:<\/p>\n<p>return brewEspresso();<\/p>\n<p>default:<\/p>\n<p>throw new CoffeeException(&#8220;CoffeeSelection [&#8221; + selection + &#8220;] not supported!&#8221;);<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>private Coffee brewEspresso() {<\/p>\n<p>Configuration config = configMap.get(CoffeeSelection.ESPRESSO);<\/p>\n<p>\/\/ grind the coffee beans<\/p>\n<p>GroundCoffee groundCoffee = this.grinder.grind(<\/p>\n<p>this.beans.get(CoffeeSelection.ESPRESSO), config.getQuantityCoffee());<\/p>\n<p>\/\/ brew an espresso<\/p>\n<p>return this.brewingUnit.brew(CoffeeSelection.ESPRESSO,<\/p>\n<p>groundCoffee, config.getQuantityWater());<\/p>\n<p>}<\/p>\n<p>private Coffee brewFilterCoffee() {<\/p>\n<p>Configuration config = configMap.get(CoffeeSelection.FILTER_COFFEE);<\/p>\n<p>\/\/ grind the coffee beans<\/p>\n<p>GroundCoffee groundCoffee = this.grinder.grind(<\/p>\n<p>this.beans.get(CoffeeSelection.FILTER_COFFEE), config.getQuantityCoffee());<\/p>\n<p>\/\/ brew a filter coffee<\/p>\n<p>return this.brewingUnit.brew(CoffeeSelection.FILTER_COFFEE,<\/p>\n<p>groundCoffee, config.getQuantityWater());<\/p>\n<p>}<\/p>\n<p>public void addBeans(CoffeeSelection sel, CoffeeBean newBeans) throws CoffeeException {<\/p>\n<p>CoffeeBean existingBeans = this.beans.get(sel);<\/p>\n<p>if (existingBeans != null) {<\/p>\n<p>if (existingBeans.getName().equals(newBeans.getName())) {<\/p>\n<p>existingBeans.setQuantity(existingBeans.getQuantity() + newBeans.getQuantity());<\/p>\n<p>} else {<\/p>\n<p>throw new CoffeeException(&#8220;Only one kind of beans supported for each CoffeeSelection.&#8221;);<\/p>\n<p>}<\/p>\n<p>} else {<\/p>\n<p>this.beans.put(sel, newBeans);<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>The Coffee class exemplifies the process for hiding information and represents a beverage produced by a CoffeeMachine. The Coffee Vending Machine encapsulates internal processes and ingredients (data).<\/p>\n<p>In Object Oriented languages, encapsulation is provided via modifiers like &#8220;private&#8221; and &#8220;protected.&#8221; Transient and volatile can likewise serve as encapsulating modifiers, but only in specific contexts.<\/p>\n<p>In addition to OOP languages, encapsulation in Java can be used in other languages. Webservices, SOA (Service Oriented Architecture), and other cutting-edge technologies are part of the notion. You can see encapsulation in real-world objects if you look closely; this is what Object Oriented Programming seeks to mimic.<\/p>\n<h2 id=\"benefits_of_encapsulation_in_java\"><span class=\"ez-toc-section\" id=\"Benefits_of_Encapsulation_in_Java\"><\/span><strong>Benefits of Encapsulation in Java<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Implementing the process of encapsulation in Java has proven to be highly effective and beneficial while programming in real-time. The following are the significant benefits of encapsulation.<\/p>\n<ul>\n<li>A class can have complete control over its data members and data methods.<\/li>\n<li>The class will maintain its data members and methods as read-only.<\/li>\n<li>Data hiding prevents the user from the complex implementations in the code.<\/li>\n<li>The variables of the class can be read-only or write-only as per the programmer&#8217;s requirement.<\/li>\n<li>Encapsulation in Java provides an option of code-reusability.<\/li>\n<li>Using encapsulation will help in making changes to an existing code quickly.<\/li>\n<li>Unit testing a code designed using encapsulation is elementary.<\/li>\n<li>Standard IDEs have the support of getters and setters; this makes coding even faster.<\/li>\n<\/ul>\n<div>\n<h2><span class=\"ez-toc-section\" id=\"Java_Encapsulation_Example_Using_Getter-Setter\"><\/span><strong><u>Java Encapsulation Example<\/u>: Using Getter-Setter<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<\/div>\n<div>Given below is an example program that demonstrate the way encapsulation is achieved in java.<\/div>\n<ul>\n<li>In the example given below, we can see that attributes firstNumber and secondNumber are private to the CalculatorVO.java class and thus it cannot be accessed directly by any outside class.<\/li>\n<li>Hence the data is getting wrapped using concept of encapsulation and could only be read or written using public getter and setter methods provided by the class.<\/li>\n<\/ul>\n<div>\n<pre><\/pre>\n<pre><code>package calculator;\r\n\r\npublic class <strong>CalculatorVO <\/strong>{\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 <strong>private <\/strong>int firstNumber;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 <strong>private <\/strong>int secondNumber;\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 public int <strong>getFirstNumber<\/strong>() {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return firstNumber;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 }\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 public void <strong>setFirstNumber<\/strong>(int firstNumber) {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 this.firstNumber = firstNumber;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 }\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 public int <strong>getSecondNumber<\/strong>() {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return secondNumber;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 }\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 public void <strong>setSecondNumber<\/strong>(int secondNumber) {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 this.secondNumber = secondNumber;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 }\r\n\r\n}\r\n<\/code><\/pre>\n<\/div>\n<hr \/>\n<h2><span class=\"ez-toc-section\" id=\"Advantages_of_Encapsulation_in_java\"><\/span><strong>Advantages of Encapsulation in java<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Listed below are the\u00a0advantages of encapsulation in java:<\/p>\n<ul>\n<li>Using encapsulation helps us to make our variable read only or write only. For example we have declared our variables firstNumber and secondNumber private. To make these variables read only we can remove the setter methods for both of them. To make it write only, we can remove the getter method. This in turn provide programming flexibility.<\/li>\n<li>Encapsulation also helps in data hiding. For instance, in our above code snippet, variables firstNumber and secondNumber is private and thus hidden from outside world. No one can access them directly. The only mean to access them is though their getter and setter method.<\/li>\n<li>Encapsulated code is easy to test and maintain.<\/li>\n<\/ul>\n<h2 id=\"conclusion\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span><strong>Conclusion<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>As an object-oriented programming principle, Java encapsulation describes the grouping of data and methods that interact with this data into a single unit.<\/p>\n<p>It&#8217;s frequently employed as a means of concealing sensitive data. This approach restricts external access to specific attributes while still allowing them to be accessed by members of the current class via public getter and setter methods. You can specify which attributes can be read or updated using these methods and validate a new value before changing an attribute using them.<\/p>\n<p><a href=\"https:\/\/bit.ly\/3ELmCiA\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-25522670 size-full\" src=\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Rectangle-1.png\" alt=\"Python and Machine Learning Rectangle\" width=\"970\" height=\"250\" srcset=\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Rectangle-1.png 970w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Rectangle-1-300x77.png 300w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Rectangle-1-768x198.png 768w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Rectangle-1-750x193.png 750w\" sizes=\"auto, (max-width: 970px) 100vw, 970px\" \/><\/a><\/p>\n<p>In order to protect user data, encapsulation provides the fundamental property of hiding data. OOP best practices like encapsulation are beneficial when paired with an APM solution like Retrace for error detection.<\/p>\n<p style=\"text-align: center;\"><strong><a href=\"https:\/\/bit.ly\/3ELmCiA\" target=\"_blank\" rel=\"noopener\">Learn Coding in your Language! Enroll Here!<\/a><\/strong><\/p>\n<\/article>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Encapsulation in Java is a powerful mechanism for storing the data members and data methods of a class together. It is done in the form of a secure field accessible by only the members of the same class. Grab the opportunity to learn Python with Entri! Click Here What is Encapsulation in Java? Encapsulation in [&hellip;]<\/p>\n","protected":false},"author":111,"featured_media":25534206,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[802,1882],"tags":[],"class_list":["post-25536018","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-articles","category-java-programming"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>What is Encapsulation in Java and How to Implement It - Entri Blog<\/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:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is Encapsulation in Java and How to Implement It - Entri Blog\" \/>\n<meta property=\"og:description\" content=\"Encapsulation in Java is a powerful mechanism for storing the data members and data methods of a class together. It is done in the form of a secure field accessible by only the members of the same class. Grab the opportunity to learn Python with Entri! Click Here What is Encapsulation in Java? Encapsulation in [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/\" \/>\n<meta property=\"og:site_name\" content=\"Entri Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/entri.me\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-07-29T19:09:45+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-11-23T09:40:26+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/07\/Why-To-Choose-The-Full-Stack-Development-For-Modern-Business..png\" \/>\n\t<meta property=\"og:image:width\" content=\"820\" \/>\n\t<meta property=\"og:image:height\" content=\"615\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Feeba Mahin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@entri_app\" \/>\n<meta name=\"twitter:site\" content=\"@entri_app\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Feeba Mahin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/\"},\"author\":{\"name\":\"Feeba Mahin\",\"@id\":\"https:\/\/entri.app\/blog\/#\/schema\/person\/f036dab84abae3dcc9390a1110d95d36\"},\"headline\":\"What is Encapsulation in Java and How to Implement It\",\"datePublished\":\"2022-07-29T19:09:45+00:00\",\"dateModified\":\"2022-11-23T09:40:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/\"},\"wordCount\":1888,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/entri.app\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/07\/Why-To-Choose-The-Full-Stack-Development-For-Modern-Business..png\",\"articleSection\":[\"Articles\",\"Java Programming\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/\",\"url\":\"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/\",\"name\":\"What is Encapsulation in Java and How to Implement It - Entri Blog\",\"isPartOf\":{\"@id\":\"https:\/\/entri.app\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/07\/Why-To-Choose-The-Full-Stack-Development-For-Modern-Business..png\",\"datePublished\":\"2022-07-29T19:09:45+00:00\",\"dateModified\":\"2022-11-23T09:40:26+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/#primaryimage\",\"url\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/07\/Why-To-Choose-The-Full-Stack-Development-For-Modern-Business..png\",\"contentUrl\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/07\/Why-To-Choose-The-Full-Stack-Development-For-Modern-Business..png\",\"width\":820,\"height\":615,\"caption\":\"Why To Choose The Full Stack Development For Modern Business.\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/entri.app\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Entri Skilling\",\"item\":\"https:\/\/entri.app\/blog\/category\/entri-skilling\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Java Programming\",\"item\":\"https:\/\/entri.app\/blog\/category\/entri-skilling\/java-programming\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"What is Encapsulation in Java and How to Implement It\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/entri.app\/blog\/#website\",\"url\":\"https:\/\/entri.app\/blog\/\",\"name\":\"Entri Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/entri.app\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/entri.app\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/entri.app\/blog\/#organization\",\"name\":\"Entri App\",\"url\":\"https:\/\/entri.app\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/entri.app\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2019\/10\/Entri-Logo-1.png\",\"contentUrl\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2019\/10\/Entri-Logo-1.png\",\"width\":989,\"height\":446,\"caption\":\"Entri App\"},\"image\":{\"@id\":\"https:\/\/entri.app\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/entri.me\/\",\"https:\/\/x.com\/entri_app\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/entri.app\/blog\/#\/schema\/person\/f036dab84abae3dcc9390a1110d95d36\",\"name\":\"Feeba Mahin\",\"url\":\"https:\/\/entri.app\/blog\/author\/feeba123\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What is Encapsulation in Java and How to Implement It - Entri Blog","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:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/","og_locale":"en_US","og_type":"article","og_title":"What is Encapsulation in Java and How to Implement It - Entri Blog","og_description":"Encapsulation in Java is a powerful mechanism for storing the data members and data methods of a class together. It is done in the form of a secure field accessible by only the members of the same class. Grab the opportunity to learn Python with Entri! Click Here What is Encapsulation in Java? Encapsulation in [&hellip;]","og_url":"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/","og_site_name":"Entri Blog","article_publisher":"https:\/\/www.facebook.com\/entri.me\/","article_published_time":"2022-07-29T19:09:45+00:00","article_modified_time":"2022-11-23T09:40:26+00:00","og_image":[{"width":820,"height":615,"url":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/07\/Why-To-Choose-The-Full-Stack-Development-For-Modern-Business..png","type":"image\/png"}],"author":"Feeba Mahin","twitter_card":"summary_large_image","twitter_creator":"@entri_app","twitter_site":"@entri_app","twitter_misc":{"Written by":"Feeba Mahin","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/#article","isPartOf":{"@id":"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/"},"author":{"name":"Feeba Mahin","@id":"https:\/\/entri.app\/blog\/#\/schema\/person\/f036dab84abae3dcc9390a1110d95d36"},"headline":"What is Encapsulation in Java and How to Implement It","datePublished":"2022-07-29T19:09:45+00:00","dateModified":"2022-11-23T09:40:26+00:00","mainEntityOfPage":{"@id":"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/"},"wordCount":1888,"commentCount":0,"publisher":{"@id":"https:\/\/entri.app\/blog\/#organization"},"image":{"@id":"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/#primaryimage"},"thumbnailUrl":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/07\/Why-To-Choose-The-Full-Stack-Development-For-Modern-Business..png","articleSection":["Articles","Java Programming"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/","url":"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/","name":"What is Encapsulation in Java and How to Implement It - Entri Blog","isPartOf":{"@id":"https:\/\/entri.app\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/#primaryimage"},"image":{"@id":"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/#primaryimage"},"thumbnailUrl":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/07\/Why-To-Choose-The-Full-Stack-Development-For-Modern-Business..png","datePublished":"2022-07-29T19:09:45+00:00","dateModified":"2022-11-23T09:40:26+00:00","breadcrumb":{"@id":"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/#primaryimage","url":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/07\/Why-To-Choose-The-Full-Stack-Development-For-Modern-Business..png","contentUrl":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/07\/Why-To-Choose-The-Full-Stack-Development-For-Modern-Business..png","width":820,"height":615,"caption":"Why To Choose The Full Stack Development For Modern Business."},{"@type":"BreadcrumbList","@id":"https:\/\/entri.app\/blog\/what-is-encapsulation-in-java-and-how-to-implement-it\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/entri.app\/blog\/"},{"@type":"ListItem","position":2,"name":"Entri Skilling","item":"https:\/\/entri.app\/blog\/category\/entri-skilling\/"},{"@type":"ListItem","position":3,"name":"Java Programming","item":"https:\/\/entri.app\/blog\/category\/entri-skilling\/java-programming\/"},{"@type":"ListItem","position":4,"name":"What is Encapsulation in Java and How to Implement It"}]},{"@type":"WebSite","@id":"https:\/\/entri.app\/blog\/#website","url":"https:\/\/entri.app\/blog\/","name":"Entri Blog","description":"","publisher":{"@id":"https:\/\/entri.app\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/entri.app\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/entri.app\/blog\/#organization","name":"Entri App","url":"https:\/\/entri.app\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/entri.app\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2019\/10\/Entri-Logo-1.png","contentUrl":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2019\/10\/Entri-Logo-1.png","width":989,"height":446,"caption":"Entri App"},"image":{"@id":"https:\/\/entri.app\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/entri.me\/","https:\/\/x.com\/entri_app"]},{"@type":"Person","@id":"https:\/\/entri.app\/blog\/#\/schema\/person\/f036dab84abae3dcc9390a1110d95d36","name":"Feeba Mahin","url":"https:\/\/entri.app\/blog\/author\/feeba123\/"}]}},"_links":{"self":[{"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/posts\/25536018","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/users\/111"}],"replies":[{"embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/comments?post=25536018"}],"version-history":[{"count":8,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/posts\/25536018\/revisions"}],"predecessor-version":[{"id":25548024,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/posts\/25536018\/revisions\/25548024"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/media\/25534206"}],"wp:attachment":[{"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/media?parent=25536018"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/categories?post=25536018"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/tags?post=25536018"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}