Not a question, but a quick friendly advice. When comparing two strings for equality ( as in homework Test Case 2 for title,subtitle and author) do not use == to check for equality, but use built-in String method .equals instead like:
stringA.equals(stringB)
Hope everyone is doing ok on the homework ;)
That is great advice, Oleg!
It is even better to use equalsIgnoreCase instead of equals in case the 2 String variables have different casing (one has lowercase, the other has uppercase letters):
String textA = "Home Page"; String textB = "home page"; //this will return false because the 2 text values have different casing boolean areEqual = textA.equals(textB);
You can fix it by converting both strings to lower case before comparing them:
String textA = "Home Page"; String textB = "home page"; //this will return true textA = textA.toLowerCase(); textB = textB.toLowerCase(); boolean areEqual = textA.equals(textB);
But it is simpler to just use
String textA = "Home Page"; String textB = "home page"; //this will return true boolean areEqual = textA.equalsIgnoreCase(textB);
Yea, that would be even better solution if we don't care about the casing :)