Forums Register Login

how come this doesn't work java?

+Pie Number of slices to send: Send
1
+Pie Number of slices to send: Send
What specifically are you having trouble with? Are you getting incorrect output? Do you get compile or runtime errors? You need to give more information about your problem.

Hunter
+Pie Number of slices to send: Send
When I give input:3
I get,

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3
at pack1.cube.main(cube.java:94)
Java Result: 1


I dry run it.i dont know where the problem resides..!!
1
+Pie Number of slices to send: Send
 

saurabh pant wrote:When I give input:3
I get,

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3
at pack1.cube.main(cube.java:94)
Java Result: 1


I dry run it.i dont know where the problem resides..!!



The error message is telling you exactly what's wrong. It's telling you that on line 94 of cube.java, you're trying to access the 4th element (at index 3) of an array that has fewer than 4 elements.
+Pie Number of slices to send: Send
I pinpointed d flaw...thanks a lot..!
1
+Pie Number of slices to send: Send
You're quite welcome!
1
+Pie Number of slices to send: Send
Welcome to the Ranch Please avoid abbreviations like “d”.
+Pie Number of slices to send: Send
I will keep that in mind...Thanks for the site...a great support...indeed..!
Get meta with me! What pursues us is our own obsessions! But not this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1016 times.
Similar Threads
June Newsletter Puzzle
Dsplaying the alphabet with a loop?
Loops
HELP~~
Can someone tell me why?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 03:48:45.