If someone could explain how this code works I would greatly appreciate it as I cannot find a great example online elsewhere. It is the code used for defining strings in a toString method that was given with the example. These are the lines I do not understand, and under is the whole method.
getCity().length() > 0 ? getCity() : "N/A";
year != 0 ? "" + year : "N/A";
public String toString() {
String displayString = getAuthor() + ", " + getTitle();
String tempCity = getCity().length() > 0 ? getCity() : "N/A";
String tempYear = year != 0 ? "" + year : "N/A";
displayString += " (" + tempCity + ", " + tempYear + ")";
displayString = displayString.length() < 73 ? displayString
: displayString.substring( 0, 69 ) + "...";
return displayString;
}