View Single Post
  #1 (permalink)  
Old 07-25-2007, 10:24 PM
romina romina is offline
Member
 
Join Date: Jul 2007
Posts: 26
romina is on a distinguished road
Error: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
I've started learning java and I have a problem executing this,
Code:
public class IfDemo { public static void main(String [] args) { int x = Integer.parseInt(args[0]); double half = 0.0; if(x!=0) { half = x/2.0; System.out.println(x+"/2="+half); } if(x==0) { System.out.println("Nothing found."); } int y = x*5; char grade ='F'; if(y >= 85) { grade='A'; } if(y>=70 &&y<85) grade='c'; System.out.println("y= "+y+" and grade = "+grade); } }
It compiles fine (I use Jcreator) but when I execute it I get this message :
Code:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at IfDemo.main(IfDemo.java:7)
Thanks.
Reply With Quote
Sponsored Links