Given
public enum Title {
MR("Mr."), MRS("Mrs."), MS("Ms.");
private final String title;
private Title(String t) {
title = t;
}
public String format(String last, String first) {
return title + "" + first + "" + last;
}
}
public static void main(String[] args){
System.out.println(Title.MR.format("Doe","John"));
}
Does anyone know how to explain this ? Keep in mind the code is not fully complete. This happens to be a question from a book. The Answer to this question is Mr. John Doe.
Thanks