Finding a problem

Report a typo

Examine the code below:

String message = "I lake: ";                                     // #1 
try (Scanner scanner = new Scanner(System.in);                   // #2
     StringBuilder stringBuilder = new StringBuilder(message)) { // #3

    stringBuilder.append(scanner.nextLine());                    // #4                   
    stringBuilder.append(scanner.nextLine());                    // #5
}
System.out.println(stringBuilder);                               // #6

Select the number of the line where a compile-time error occurs.

Select one or more options from the list
___

Create a free account to access the full topic