venerdì 29 marzo 2013

Q90

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.
blackZowboyHat.setName = “Cowboy Hat”;
B.
setName(“Cowboy Hat”);
C.
Hat.setName(“Cowboy Hat”);
D.
blackCowboyHat.setName(“Cowboy Hat”);
Risposta : D

Nessun commento:

Posta un commento