• Post Reply Bookmark Topic Watch Topic
  • New Topic

intersection of loops  RSS feed

 
Anam Zahra
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody
I am facing a situation in which I have to print those values which have not chosen by the user. For example

Out put of this code is
1
2
3
4
8
9
In if condition I have mentioned 5,6 and 7 so these are not printing. But if I get these values from database like

Now suppose id now contains 5,6 and 7 and I want to print other values may be from 1 to 100. Then how I will handle all these things in one program.
Actually I want to show only those values which have not chosen by the user. Please help me in this regard. Thanks.
 
Koushik Ghosh
Greenhorn
Posts: 25
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
first add all user inputs in a Collection or array.
eg.

then once you have all user inputs, check it in your loop
eg.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!