Can someone explain to me how does the lines no 4 and 5 work? Do they act like if statemens? *See the inline comment.
public void display() {
String info = "Name:" + name + "; ";
info += "ID:" + id + "; ";
info += "GPA:" + ((gpa > 0.0)?gpa:"None") + "; "; //If i feed the gpa the value 0.0 it will display "None" shouldn't be the other way around?
info += "Major:" + ((major != null)?major:"None");
System.out.println(info);
}
Aucun commentaire:
Enregistrer un commentaire