Win a copy of Learning Regular Expressions this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Why does this for-loop break when iterating through a multidimensional array?  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What I'm trying to do is create an editable calendar made up of arrays.

First I create some variables:



Then I try to use nested for-loops to allow the user to say when they are usually asleep:

  
When I was building, I always had

var quantifiedMonth

set to 0, which allowed the program to work. Then I realized that if I set it to 1, then it breaks. I can't wrap my head around why, because of the output that I got when the program worked.

Say I had



then my output would be



but when



the program crashes. I can't wrap my head around why that is. To my mind, I shouldn't be able to get the output I do when



Please help. I tried to be thorough in my question, but if I'm being vague about something, please let me know.

Here's some screenshots of the errors I get

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!