View the Exhibit.
public class Hat {
public int ID =0;
public String name = “hat”;
public String size = “One Size Fit All”;
public String color=””;
public String getName() { return name; }
public void setName(String name) {
this.name = name;
}
}
Given
public class TestHat {
public static void main(String[] args) {
Hat blackCowboyHat = new Hat();
}
}
Which statement sets the name of the Hat instance?
A.
blackCowboyHat.setName = “Cowboy Hat”;
B.
setName(“Cowboy Hat”);
C.
Hat.setName(“Cowboy Hat”);
D.
blackCowboyHat.setName(“Cowboy Hat”);