Exception

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mailmear45
    New Member
    • Mar 2010
    • 3

    Exception

    HI
    I am new to java and facing a problem
    exception in thread main java.lang.Array IndexOutOfBound sException.

    I an trying to a input a no thr cmd for this i have code like this
    class enterno
    {
    public static void main(String args[])
    {
    int a=Integer.parse Int(args[0]);
    System.out.prin tln(" you have entered these values : " + a );
    }
    }

    Plz help me to solve this...
    Thanks
  • anurag275125
    New Member
    • Aug 2009
    • 79

    #2
    I think You're getting ArrayIndexOutOf BoundsException , because you're trying to run program like this..
    c:\>java enterno (you're not specifying any parameter)

    Run it as:
    c:\>java enterno 12

    Comment

    Working...