File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes werid output for  For loop Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "werid output for  For loop" Watch "werid output for  For loop" New topic
Author

werid output for For loop

Sherif Shehab
Ranch Hand

Joined: Mar 05, 2007
Posts: 483

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


Thanks,
Sherif
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4642
    
    5

You're printing to two different print streams that aren't synchronized -- System.err and System.out. Why?


luck, db
There are no new questions, but there may be new answers.
Sherif Shehab
Ranch Hand

Joined: Mar 05, 2007
Posts: 483

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

Joined: Mar 05, 2007
Posts: 483

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

Joined: Jun 24, 2003
Posts: 3274
    
    5

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.


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

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.


Steve
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: werid output for For loop