You are viewing a single comment's thread. Return to all comments →
1 - It's a bad pattern to compare a boolean with true/false like that: "scan.hasNext() == true"
Explanation: if the variable is a boolean, doesn't need "== true"
2 - If you have to do a loop that uses the return of a boolean method (like "scan.hasNext()"), prefer to use while.
Explanation: Your code is more beautifull and readable. Clean code is a good practice.
Help this helps you