You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All the public class and method access modifiers in the bob reference solution can be changed to package private (which is the default therefore the access modifier can be left out). For example, in Bob.java, public class Bob { should be changed to class Bob {.
We do this since it's best practice to restrict access to a class and its methods as much as possible (see our POLICIES doc for more information).
Also, there are if statements in the reference solution that aren't enclosed in curly braces, e.g.:
if (isQuestion(input))
return "Sure.";
This is generally considered bad practice because it's very easy to add another line of code and not realise that it won't be part of the if statement. For example:
if (isQuestion(input))
callSomeMethod();
return "Sure.";
is the same as:
if (isQuestion(input)) {
callSomeMethod();
}
return "Sure";
which isn't obvious. Therefore all the if statements in the reference solution should have curly braces.
Activity