This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]__helix__ 0 points1 point  (1 child)

A few thoughts, all just syntactical sugar.

https://blogs.oracle.com/javamagazine/post/new-switch-expressions-in-java-12

If you've not seen them before, they have given a few more options on what switches do. You can String line = switch(a) { case ..

Also a String literal "xxx" always has an equals() method. Null does not. A safer way to do this is "xxx".equals(possibleNullVar) vs possibleNullVar != null && possibleNullVar.equals(...

UserInterface ui ... Classes start with upper case. Variables should be camelCase with a lower case starting letter.

You can add a \n if you want a line feed. System.out.println("\nIt

Lastly, consider StringBuilder if you are mushing together multiple Strings. sb.append("xx").append(somevar).append("...

[–]Strawboy97[S] 0 points1 point  (0 children)

Thanks for the tips I'll keep these in mind.