Answer with a given JAVA question below.   Consider the following code:   public class Quiz{         public String name;         public double totalPoints;            public String getName() {    return this.name;    }          public double getTotalPoints() {      return this.totalPoints;    } } Based on the Java code, explain where information hiding is being violated, why it is considered a violation, and how a programmer should fix the violation.

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

Answer with a given JAVA question below.

 

Consider the following code:

 

public class Quiz{

        public String name;

        public double totalPoints;

 

         public String getName() {    return this.name;    }

         public double getTotalPoints() {      return this.totalPoints;    }

}

Based on the Java code, explain where information hiding is being violated, why it is considered a violation, and how a programmer should fix the violation.

Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Adjacency Matrix
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT