Using Jcreator, open, compile, and run java and observe its runtime. Write your observation regarding how encapsulation works for the program and the data it processed. Limit your paper to a single paragraph with at least 50 words or five (5) sentences.   Source code: public class EncapTest {    private String name;    private String idNum;    private int age;    public int getAge() {       return age;    }    public String getName() {       return name;    }    public String getIdNum() {       return idNum;    }    public void setAge( int newAge) {       age = newAge;    }    public void setName(String newName) {       name = newName;    }    public void setIdNum( String newId) {       idNum = newId;    } } public class RunEncap {    public static void main(String args[]) {       EncapTest encap = new EncapTest();       encap.setName("James");       encap.setAge(20);       encap.setIdNum("12343ms");       System.out.print("Name : " + encap.getName() + " Age : " + encap.getAge());    } }

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 14RQ
icon
Related questions
Question

Using Jcreator, open, compile, and run java and observe its runtime. Write your observation regarding how encapsulation works for the program and the data it processed. Limit your paper to a single paragraph with at least 50 words or five (5) sentences.

 

Source code:

public class EncapTest {
   private String name;
   private String idNum;
   private int age;

   public int getAge() {
      return age;
   }

   public String getName() {
      return name;
   }

   public String getIdNum() {
      return idNum;
   }

   public void setAge( int newAge) {
      age = newAge;
   }

   public void setName(String newName) {
      name = newName;
   }

   public void setIdNum( String newId) {
      idNum = newId;
   }
}

public class RunEncap {

   public static void main(String args[]) {
      EncapTest encap = new EncapTest();
      encap.setName("James");
      encap.setAge(20);
      encap.setIdNum("12343ms");

      System.out.print("Name : " + encap.getName() + " Age : " + encap.getAge());
   }
}

 

 

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Developing computer interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Principles of Information Systems (MindTap Course…
Principles of Information Systems (MindTap Course…
Computer Science
ISBN:
9781285867168
Author:
Ralph Stair, George Reynolds
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT