| Author |
Help with my code to find MinOfAll numbers
|
Hmbj Shah
Greenhorn
Joined: Apr 19, 2010
Posts: 3
|
|
Hello Everyone,
I am new to Programming world and so to Java,
I tried my hands on writing the following code to find minimum of all the numbers entered via command prompt,
but I am getting the error
Exception in thread "main" java.lang.ArrayIndexOutOfBound Exception :5 at MinOfAll.main
Kindly tell me where am I going wrong?
|
HS
|
 |
Hunter McMillen
Ranch Hand
Joined: Mar 13, 2009
Posts: 490
|
|
instead of doing Integer.parseInt(args[0]); at line 5 try putting a high number in there, 999 for example, so that you know for sure that some of the numbers you are passing in will be lower. Also inside you for loop don't add 1 to i.
-Hunter
|
"If the facts don't fit the theory, get new facts" --Albert Einstein
|
 |
Hmbj Shah
Greenhorn
Joined: Apr 19, 2010
Posts: 3
|
|
Thank You Hunter, it worked.
Appreciate it !!
|
 |
Devaka Cooray
Saloon Keeper
Joined: Jul 29, 2008
Posts: 2726
|
|
|
"Maverick Hs", please check your private messages regarding an important administrative matter.
|
Author of ExamLab (Download) - the free mock exam kit for SCJP / OCPJP
Home Page -- Twitter Profile -- JavaRanch FAQ -- How to Ask a Question
|
 |
 |
|
|
subject: Help with my code to find MinOfAll numbers
|
|
|