The mistakes everyone makes in Week 1 — and how to fix them
== operator compares whether two variables point to the same object in memory, not whether the text is the same. The .equals() method compares the actual content of the Strings character by character. Always use .equals() (or .equalsIgnoreCase()) for String comparison.25 and press Enter, the input buffer contains 25\n. The nextInt() reads only the 25 and leaves the \n (newline) sitting in the buffer. The next nextLine() sees that leftover \n and thinks it got its input. Adding an extra scanner.nextLine() right after nextInt() consumes that leftover newline.int, Java does integer division and truncates the decimal part. The result type of the expression is determined before it gets assigned to the variable. Making at least one operand a double forces Java to use decimal division.switch statement, once a matching case is found, Java executes all code from that point downward — including other cases — unless it hits a break. This is called "fall-through." Always add break; at the end of each case unless you intentionally want fall-through behavior.System.out.print() outputs text without adding a newline at the end. System.out.println() does the same thing but adds a newline character after the text, so each piece of output appears on its own line. In this course, always use println() for prompts and output.Scanner parameter, you must provide one when calling it. The method needs that Scanner object to read user input. Think of parameters as ingredients a recipe requires — you cannot skip them.Scanner in main() and pass it as a parameter to any method that needs user input. This is cleaner, avoids resource conflicts, and is the preferred pattern in this course. Never re-declare new Scanner(System.in) in multiple methods.nextInt() can only read whole numbers. If the user types a decimal like 25.5 or text like "hello", Java throws an InputMismatchException and the program crashes. Match your Scanner method to the type of input you expect: nextInt() for integers, nextDouble() for decimals, nextLine() for text.int), it promises to give back a value of that type. If your method does not need to return anything, use void as the return type instead. If it does return something, every possible code path must end with a return statement.+ left to right. When it sees "Score: " + a, the String forces concatenation, producing "Score: 10". Then "Score: 10" + b concatenates again to give "Score: 1020". Wrapping (a + b) in parentheses forces Java to do the math first (because both operands are int), then concatenate the result with the String.Click any error to expand it. These are the most common mistakes from Week 1 exercises.