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
-
The error that I am getting is this "Time Machine can't use the disk image because it can't be written to." Any ideas on the fix for this? When I go to the Time Capsule my Macbook Pro shows that it is locked, I think I did something wrong, but can't figure how to unlock it to see if that fixes it.
As far as we know, Time Machine cannot write to a disk image. It needs to write directly to the Time Capsule disk.
-
Hello ,
For my user id, I have the authorization for the transaction, but still iam getting the error that, you don’t have authorization, plz suggest?????
ThnksHello Sampath,
after you have received the error message about the no authorization, run transaction SU53.
This transaction shows which authorization has failed last time.
Best regards,
Laszlo -
The error that my icloud account is full and need more storage stays on the screen of my Ipad2. It won't allow me to get more, turn it off or do anything on it. Help!!
Reset: Hold the Sleep/Wake and Home buttons until the screen goes dark and the Apple logo appears
Then do some house cleaning in iCloud (or purchase more storage)
Settings > iCloud > Storage & Backup > Manage Storage > Select a device if more that one > Show All Apps and turn off some apps that you don't need or care to be backed up.
Also, connect to iTunes and empty your Camera Roll onto your computer. Photos & videos tend to eat up a lot of space. -
I'm not techinal so please bear with me. I don't have the bar that allows me to type in a website. I did have a few minutes ago. When I make the page full screen and move my cursor to the top of the page, the bar drops down and I can use it. I've tried restarting my computer, didn't work. Help!
Well I figured it out, right click the arrow that makes the screen bigger and unclick the Hide Toolbar. I knew it couldn't be that hard.
-
I have done all of the steps that Apple have said to do, including completely restarting my phone and registering it as a new one, but still my wifi is greyed out, can anyone help me?
http://support.apple.com/kb/ht5621
-
Is there a way to remove your sim card if you don't have the tool that came with your phone?
Is there a way to remove your sim card if you don't have the tool that came with your phone? I wanted to see if I could upload my old information to the iCloud, by putting the new sim card into the old phone, since I didn't before I updated my new phone.
Any metal clip will do. Insert the tip in the little hole next to the Sim Card and press FIRMLY. The SIM drawer will pop out.
-
I am trying to install xcode on a macpro running OSX 10.6.8 . It installs, but with the error that there is no unix support. Do I have to upgrade to Lion 10.7 to do this? And if so, is this a free upgrade if I have the extended 3 yr support?
thx,
PandabigXcode 4.x cannot be installed on Snow Leopard. You need a 3.x. So if that is what you used then yes, you need to install lion. If connect.apple.com still alows registration or logins using an existing appleid then you could download the last xcode 3.2.6 for free.
-
I am using a WD My Passport Studio external hard drive as a Time Machine. I get the error that a back up folder could not be created when my iMac has been asleep, any advice. The hard drive is set set not to go to sleep.
Were you not plugged in via USB to begin with?
I would recommend performing some resets just to be on the safe side. Unplug the external HD, and try these steps:
http://support.apple.com/kb/HT3964
http://support.apple.com/kb/HT1379 -
Unable to get Quick time movies to play on my imac. This is the error message I allways get.
"The document “4-20130701090400-7.mp4” could not be opened. The movie is not in a format that QuickTime Player understands.You may need to install additional software to open this type of file."Download and install VLC Player. It plays more formats and is free and highly regarded.
http://vlc-media-player.en.softonic.com/mac
Cheers
Pete -
I keep getting the error that says: "APSDAEMON.exe cannot open since itunes can't find the msvcr80.dll file. Any assistance on how to fix this is greatly appreciated.
Click here and follow the instructions.
(98703) -
i don't have the computer that my iPod was registered to and i forgot my password because i just found my phone after being lost for 2 years. Idk what to do so i can access my ipod.
Place the iOS device in Recovery Mode and then connect to your computer and restore via iTunes. The iPod will be erased.
iOS: Wrong passcode results in red disabled screen
If recovery mode does not work try DFU mode.
How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
For how to restore:
iTunes: Restoring iOS software
To restore from backup see:
iOS: Back up and restore your iOS device with iCloud or iTunes
If you restore from iCloud backup the apps will be automatically downloaded. If you restore from iTunes backup the apps and music have to be in the iTunes library since synced media like apps and music are not included in the backup of the iOS device that iTunes makes.
You can redownload most iTunes purchases by:
Downloading past purchases from the App Store, iBookstore, and iTunes Store
If problem what happens or does not happen and when in the instructions? When you successfully get the iPod in recovery mode and connect to computer iTunes should say it found an iPod in recovery mode. -
I own CS5 on my work laptop which was just stolen. Do I need to buy a new CS from scratch or can I transfer CS5 to a new computer even though I don't have the computer that CS5 is on? Company purchased CS5 before the whole creative cloud leasing thing started, but after discs.
You can use web chat to remove authorization from the computer that was stolen:
Serial number and activation support
You can download the software again here:
Other downloads -
When i try to download Xcode i get the error that it cannot be installed on "macintosh hd"
when i try to download xcode i get the error that it cannot be installed because of "macintosh hd" and me not having os x version 10.8.4!!!
please help meCorrect.
System requirements for XCode is 10.8.4 and above. Since you have 10.7.5 it can't be installed. -
I have a 4 min video I am working on. It has picture in picture, voice, stills, and video. When I try to export it as a mobile file to send to a coworker i get the error that it quit unexpectedly. Any suggestions?
You have to update the software.
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
-
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.