Find NPE

Report a typo

Examine the code below:

String str1 = null;
String str2 = "123";

if (!str2.equals(str1)) {        // #1
    str2 = null;                 // #2
}

str1 = str2;                     // #3
str2 = str1;                     // #4

System.out.println(str2);        // #5

Write the number of the line where NPE occurs.

If you think the code is correct, write the output of this code.

Enter a short text
___

Create a free account to access the full topic