aspose file tools*
The moose likes Beginning Java and the fly likes Help with my code to find MinOfAll numbers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help with my code to find MinOfAll numbers" Watch "Help with my code to find MinOfAll numbers" New topic
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: 492

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
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3216
    
  49

"Maverick Hs", please check your private messages regarding an important administrative matter.


Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help with my code to find MinOfAll numbers