Skip to content

Commit 95f2c19

Browse files
committed
Sonar bug fixes using Yoda condition in equals expression when comparing String literal with String object.
Using try-with-resources if we use Scanner to close the underlying stream is a good practice to handle resources. Minimal refactor.
1 parent 120033b commit 95f2c19

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

hexagonal/src/main/java/com/iluwatar/hexagonal/service/ConsoleLottery.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public static void main(String[] args) {
6767
addFundsToLotteryAccount(bank, scanner);
6868
} else if ("3".equals(cmd)) {
6969
submitTicket(service, scanner);
70-
} else if (cmd.equals("4")) {
70+
} else if ("4".equals(cmd)) {
7171
checkTicket(service, scanner);
7272
} else if ("5".equals(cmd)) {
7373
exit = true;

0 commit comments

Comments
 (0)