Exception in thread “main” java.lang.ArrayIndexOutOfBoundsException: 0 error in Java

前端 未结 8 2005
清酒与你
清酒与你 2021-01-07 05:52

When i tried running this code I get this error..I dont know where i went wrong..

Exception in thread \"main\" java.lang.ArrayIndexOutOfBoundsException: 0
           


        
8条回答
  •  一整个雨季
    2021-01-07 05:54

    public class NewMain {
    
        public static void main(String[] args) {
    
           int argslen=args.length;
            int argsValue[] = new int[argslen];
            for (String i:args) {
               int d = 0;
               argsValue[d]=Integer.parseInt(i);
               System.out.print(argsValue[d]+"\t");
    
            }
    
        }
    }
    

提交回复
热议问题