Question: public class SimpleClass { private int id; private String name; public SimpleClass() { name = ; id = 0; } public void setName(String name) {
public class SimpleClass { private int id; private String name; public SimpleClass() { name = ; id = 0; } public void setName(String name) { this.name = name; } } THE FOLLOWING 3 QUESTIONS REFER TO THE CODE FRAGMENT ABOVE BASE YOUR ANSWERS ON WHAT YOU SEE DONT ASSUME ANYTHING! 1. SimpleClass cannot be executed as a standalone program/process : (a) TRUE (b) FALSE Explain: ___________________________________________ 2. Given the implementation of SimpleClass above, which of the following attempts to create an instance of it would compile successfully? (pick one): (a) SimpleClass simple = CSI; (b) SimpleClass simpleClass = new SimpleClass(CSI); (c) SimpleClass simple = SimpleClass(); (d) SimpleClass simpleClass = new SimpleClass(); 3. Did the implementer of SimpleClass consider encapsulation when designing/coding this simple class? (a) Yes! (b) No! Explain: ______________________________________________________ _____________________________________________________________
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
