Given: What is the result?
A.
A NullPointerException is thrown at runtime
B.
: Fresco
C.
null : Fresco
D.
Fresco : Fresco
Given: What is the result?
A.
A NullPointerException is thrown at runtime
B.
: Fresco
C.
null : Fresco
D.
Fresco : Fresco
C
C, tested it
public class Painting {
public 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.println(obj1.getType() + ” ” + obj2.getType());
}
}
c