You are asked to develop a program for a shopping application, and you are given the following information:
Which definition of the Toy class adds a valid layer of abstraction to the class hierarchy?
Given:
public class Painting {
private String type;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public static void main(String[] args) {
Painting obj1 = new Painting();
Painting obj2 = new Painting();
obj1.setType(null);
obj2.setType("Fresco");
System.out.print(obj1.getType() + " : " + obj2.getType());
}
}
What is the result?
Given the code fragment:
Assume that the system date is June 20, 2014.
What is the result?