Question: What is the difference between the public and private keywords? a. O Public members are usable only in Java, while private members are usable in

 What is the difference between the public and private keywords? a.

What is the difference between the public and private keywords? a. O Public members are usable only in Java, while private members are usable in other programming languages. b. O A class can be public, private, or both, depending on the situation. c. OThe public keyword can only be used on methods, and the private keyword can only be used on fields. d. O Items declared public may be seen and used from any class, while items declared private may be seen and used only from within their own class. e. O Public fields can be seen in two Java programs at a time while private fields can be seen in only one Java program (order shuffled) What items should be declared private? a. O All instance methods should be private to keep them from being called by malicious clients, for better security. b. O Fields and constructors should both always be private, but methods should always be public. c. O Classes should be declared private, but methods and fields should be public. d. O Objects' fields should be declared private to provide encapsulation, so that external code can't make unwanted direct noheant feid of a ciass should be private, bu e. O The most important field of a class should be private, but the other less important fields can be public. (order shuffled)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!