class Main { public static void main(String[] args) { String str = null; System.out.println(str.length()); // ここでNullPointerExceptionが発生する } }