-1

It's showing a NullPointerException for Strintg.trim()

 String line = br.readLine(); 
 String[] strs = line.trim().split("\\s+");
 for (int i = 0; i < n; i++) {
  a[i] = Integer.parseInt(strs[i]);
      }
  • Did you tried `System.out.println(line)` or `System.out.println( ">" + line + " – azro May 15 '22 at 08:44
  • Read the javadocs for `BufferedReader`. The `readLine()` method will return `null` at end of file. Ergo your application is attempting to read at the end of file. Solutions: find out why that is and/or test for `null`. – Stephen C May 15 '22 at 09:04

0 Answers0