title: Java Spitting a String by comma doesn't work
body: <p>Input :
  5
  BatsmanA,20
  BatsmanB,25
  BatsmanC,40
  BatsmanD,10
  BatsmanE,20</p>
  <p>The output must print the Batsman name who scored the largest runs. Here the output must be BatsmanC</p>
  <pre><code>public static void main(String[] args) {
      //Your Code Here
      Scanner sc = new Scanner(System.in);
      int N = sc.nextInt();
      int max = 0;
      String batsman = &quot;&quot;;
      
      for(int i =0; i&lt; N; i++){
          String a = sc.nextLine();
          String[] n = a.split(&quot;,&quot;);
          int b = Integer.parseInt(n[1]);
          
          if (b &gt; max){
              max = b;
              batsman = n[0];
          }
      }
      
      System.out.print(batsman);
  }
  </code></pre>
  <p>However, I get an error. ArrayIndexOutOfException Error.</p>
  <p>Exception in thread &quot;main&quot; java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
  at Main.main(Main.java:14)</p>