I don't undersand the error that I am getting

here is my code for reference
public class shop5{      
     public static void main(String[]args){
        int aftersixsum=0;//int is set to 0
         int[]array4 = new int[args.length-1];//creates a new int array that has up to spot four, and five spots overall
      for(int i=0;i<args.length-1;i++)//scans the command line
          args[i] = Integer.parseInt(args);//turns all of the command line arguments into ints
          if(args[i].equals(6))//if (while scanning) i is equal to 6
               for(int j = i;j<args.length-1;j++)//scan from i to the end of the new array of ints
                    array4[i] = args[j];//put in the empty array 6 as well as all the numbers after 6 into this new array
     for(int i = 1;i<array4.length;i++)//scan the new array starting from the second position
          aftersixsum+=array4[i];//(because 6 would be at the first spot) sum all of the numbers after 6
System.out.println(aftersixsum);
}When I run it with the input 5 4 3 6 2, i get the error:
Exception in thread "main" java.lang.NoClassDefFoundError: lab5
The purpose is to take in a group of command line integer arguments, and to print out the sum of all the numbers after 6.   I need to watch out for when the last spot is 6.
I have commented out what I think happens when the program runs.  I am thinking that the problem is in this line: args[i] = Integer.parseInt(args[i]);Could anyone help me?  Thank you much in advance.
PS: how close are my comments to what is actually going on?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

your code has some errors during the compilation time
you can't assign the integer value to string
args[i] = Integer.parseInt(args);//turns all of the command line arguments into ints
its one of the error.
this is next error -> here your assigning a string value to int
array4[i] = args[j];

Similar Messages

Maybe you are looking for

  • Please help me.  I cannot import videos into itunes library

    I have read the manual's entries on doing this and nothing seems to be working. It won't let me import my own videos into the itunes library for me to convert to a file recognized by ipod. I have a 5th generation ipod. I am doing everything it tells

  • Photoshop CS1 wont open anything - big issues!

    Hi Photoshop has started to do an odd thing ...and I am in crisis as I am a photographer and kind of need it! It will not open ANY image file, of any size, or any time via any opening method - double clicking on the file, dragging onto the dock icon,

  • Printing on both side of the form page front and back

    Hi experts,              while developing a purchase order i have come across a requirement to print on both sides of the page on the front side i wont to print the normal calculation and on the back side i have to print the terms and condition of th

  • Please help in creating query

    I have 3 tables 1. Person table. The columns are PersonID, PersonName and isActive . PersonID is the primary key 2. Vendor Table The columns are VendorID and VendorName. VendorID is the primary key 3. Vendor_Prod table The columns are Ven_prod_id,Ven

  • Simple currency data type  calculation doubt

    Hello All, net_price2 = '12.10'. DATA : NET_PRICE2 TYPE  CHAR20,        NET_PRICE TYPE KBETR,        NET_PRICE1 TYPE CHAR20,        C TYPE CHAR20. C = 1. LOOP AT ITAB2. NET_PRICE = ITAB2-KBETR * C. C = NET_PRICE. SHIFT C LEFT DELETING LEADING SPACE.