1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Lena [83]
3 years ago
9

Data hiding, which means that critical data stored inside the object is protected from code outside the object, is accomplished

in Java by: A. using the public access specifier on the class methods B. using the private access specifier on the class methods C. using the private access specifier on the class definition D. using the private access specifier on the class fields
Computers and Technology
1 answer:
algol [13]3 years ago
7 0

Answer:

Option (D) using the private access specifier on the class fields

Explanation:

  • The private access modifier can be used to hide the data.
  • Methods and data variables ( fields ) can be declared with the private access modifier.
  • Data hiding is a OOPS Concept which can be achieved with the private keyword (private access modifier).
  • The access modifiers are of types Public, Private, Protected and Default ( no access modifier - no need to explicitly specify the default keyword).
  • Data hiding means to hide the data, the data is contained in the class variables.So, option (d) using private access modifier on the class fields is correct option.
  • Option (A) is wrong as the using the public access modifier doesn't hide anything. It is public and is visible to the public.
  • Option (B) is wrong as using the private access modifier on the methods means it is hiding the implementation of the methods not the data.
  • Option (C) is wrong as using private access modifiers on class definition means making the classes not visible to other classes it doesn't mean data hiding as the data is contained in the class variables.
You might be interested in
Set methods are also commonly called _____ methods, and get methods are also commonly called _____ methods.
WITCHER [35]

Answer:

mutator, accessor

Explanation:

Set methods are commonly called mutator methods, and get methods are commonly called accessor methods.

This is because set methods are used to mutate the state of a variable. Get methods, on the other hand are used to access the current state of the variable.

For example:

class Demo{

    //Member variable

    private int var;

    //Accessor method

    public int getVar(){

          return var;

    }

    //Mutator method

    public void setVar(int value){

         var=value;

    }

}

7 0
3 years ago
Ryan has created a Word document to be used as a review quiz for students in a classroom setting. The document contains both que
kozerog [31]

Answer:

Include the answers on an additional sheet.

3 0
3 years ago
The "network of networks," consisting of LANs (Local Area Networksnetworks connecting two or more computers, usually within the
irina1246 [14]

Answer:

Internet

Explanation:

Internet is very often called the network of networks, creating a bridge between many networks and joining larger networks to another.

5 0
3 years ago
Who is good with Introduction to photography? I don’t know nothing about cameras if you do please contact me ASAP
son4ous [18]

ok i can help you with your questions

5 0
3 years ago
Why is a class an excellent representation of an abstract data type?
JulsSmile [24]

Answer:

 A class is an good representation of the abstract data type as it is represented independently. For implementing a class, it is use to specify the interface for an abstract class.

Class is one of the type of abstract data type for the objects that whose behavior is basically define by the set of operations and values. It is known as abstract as, it provide an implementation independently.

When the class is using in an abstract data type, then it refers as hidden representation of the data. In this modern era, class is use for the implementation of the abstract data type.

6 0
3 years ago
Other questions:
  • What's the fastest way to reset Android pin?​
    5·1 answer
  • Which command can be used to manually add a package to the driver store?
    13·1 answer
  • You manage an NLB cluster composed of three servers: Server1, Server2 and Server3. Your maintenance schedule indicates that Serv
    15·1 answer
  • Without protocols the information sent and received through the Internet would never reach its intended target and even if it di
    6·1 answer
  • What characters cannot be used in a filename?
    15·1 answer
  • Supp guees how your dayyyyyyyyyyyy
    10·2 answers
  • Which of the examples is part of client-side code?
    12·1 answer
  • A local bank has just one branch. It sets up a peer-to-peer network for all devices on the system. The bank would like to be abl
    8·2 answers
  • What is the output?
    7·1 answer
  • The quickest way to change a word is to double
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!