Update Main.java

try/catch replaced char == '\u0000'