Avoid NPE

Report a typo

Here's a program that may throw NullPointerException. Fix it to avoid the exception.

In the case when the exception may occur, the program should print the string "NPE!".

Write a program in Java 17
import java.util.*;

class FixingNullPointerException {

public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String string = scanner.nextLine();
string = "null".equals(string) ? null : string;
/* Do not change code above */

System.out.println(string.toLowerCase());
}
}
___

Create a free account to access the full topic