aspose file tools*
The moose likes Beginning Java and the fly likes Need help in data displaying Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Need help in data displaying" Watch "Need help in data displaying" New topic
Author

Need help in data displaying

pankaj semwal
Ranch Hand

Joined: Oct 07, 2008
Posts: 301
HI,
Below is my code which printing month and year and the out put is displaying like this :

Month 1 Year 2009
Month 2 Year 2009
Month 3 Year 2009
Month 4 Year 2009
Month 5 Year 2009
Month 6 Year 2009
Month 7 Year 2009
Month 8 Year 2009
Month 9 Year 2009
Month 10 Year 2009
Month 11 Year 2009
Month 12 Year 2009
Month 1 Year 2010
Month 2 Year 2010
Month 3 Year 2010
Month 4 Year 2010
Month 5 Year 2010
Month 6 Year 2010
Month 7 Year 2010
Month 8 Year 2010
Month 9 Year 2010
Month 10 Year 2010
Month 11 Year 2010
Month 12 Year 2010


and want to run this loop only till month is 6 and year is 2010. like this
Month 1 Year 2009
Month 2 Year 2009
Month 3 Year 2009
Month 4 Year 2009
Month 5 Year 2009
Month 6 Year 2009
Month 7 Year 2009
Month 8 Year 2009
Month 9 Year 2009
Month 10 Year 2009
Month 11 Year 2009
Month 12 Year 2009
Month 1 Year 2010
Month 2 Year 2010
Month 3 Year 2010
Month 4 Year 2010
Month 5 Year 2010
Month 6 Year 2010








Please help me.

Thanks
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14266
    
  21

Add an if statement inside the for loop with a break; to exit the loop when i == 5 and minYear == 2010.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Abimaran Kugathasan
Ranch Hand

Joined: Nov 04, 2009
Posts: 2066

Check whether, this code suits you or not..


|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
pankaj semwal
Ranch Hand

Joined: Oct 07, 2008
Posts: 301
Thanks Guys
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need help in data displaying