Question about tables

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Nov 2009
Posts: 1
Reputation: 2Mas is an unknown quantity at this point 
Solved Threads: 0
2Mas 2Mas is offline Offline
Newbie Poster

Question about tables

 
0
  #1
Nov 5th, 2009
I have an int table, consisting of 7 ints, and is wondering if there is any way of avoiding the same int to be entered twice. And if entering the same int twice, the user of the program would have to re-enter the int again.

this is what i've got so far, but it doesn't seem to work at all..

  1. if(tab1[i] == tab1[i])
  2. System.out.println(tab1[i]+" is already used");
  3. //reduses index
  4. i--;
  5. kb.nextLine();
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 332
Reputation: quuba is on a distinguished road 
Solved Threads: 54
quuba quuba is offline Offline
Posting Whiz
 
0
  #2
Nov 5th, 2009
write the method
boolean contanis(int i)
in this method loop around the array, if value associated with current loop-index is equal to i-value return true...
Last edited by quuba; Nov 5th, 2009 at 1:28 pm.
Reply With Quote Quick reply to this message  
Reply

Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC