Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

werid output for For loop

 
Sherif Shehab
Ranch Hand
Posts: 485
Android Eclipse IDE Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
I'm facing a weird problem with for loop , here is my code



this is the output



you will find my questions as comments in the code and the output . what i wanna do is when i = 0 it goes to the inner for loop till x reaches 28 then increment i by ...etc till i reaches 13 ..

Any thing i was missing ?

Happy new year to all
 
Darryl Burke
Bartender
Posts: 5115
11
Java Netbeans IDE Opera
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're printing to two different print streams that aren't synchronized -- System.err and System.out. Why?
 
Sherif Shehab
Ranch Hand
Posts: 485
Android Eclipse IDE Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Darryl Burke:
You're printing to two different print streams that aren't synchronized -- System.err and System.out. Why?


Opps, what a silly stuff i missed , may be i need to rest i'm working for 13 hours till now , ya i just made all System.out and working fine now
 
Sherif Shehab
Ranch Hand
Posts: 485
Android Eclipse IDE Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Darryl Burke:
You're printing to two different print streams that aren't synchronized -- System.err and System.out. Why?


why when i'm printing this inside the inner loop giving me this exception
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because there is no element at position x for that list. I'd also split out your code a little so that you can clearly see when you are accessing what.
 
Steve Luke
Bartender
Pie
Posts: 4181
21
IntelliJ IDE Java Python
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sherif Shehab:


why when i'm printing this inside the inner loop giving me this exception


Because either the inner or outer vector used in vBckTableTotal is empty, and so doesn't have an index 0.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic