title: ERROR: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at test.main(test.java:8)
body: <pre><code>//i m doing this program for checking switch condition but there is an error
  </code></pre>
  
  <p>so can you please help to solve this
      public class test {</p>
  
  <pre><code>public static void main(String[] args) throws Exception
  {
      **char grade = args[0].charAt(0);**//here is the error
  
  try {
      switch (grade){
              case A:{
          System.out.println("CASE A");
          break;
      }
      case 'B':{
          System.out.println("CASE B");
      }
      case 'C':{
          System.out.println("CASE C");
      }
      case 'D':{
          System.out.println("CASE D");
      }
      default:
          System.out.println("last");
      }
  
  } catch (Exception e) {
      // TODO: handle exception
  }
  System.out.println("what is this");
  
      }       
      }
  </code></pre>
  
  <p>java.lang.ArrayIndexOutOfBoundsException: 0 error occuring how should i resolve it</p>