ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
Google
 
Categories  >>  Code Snippets  >>  Programming Code  >>  Java Code  >>  J2SE Code
 
 


 

 
 J2SE Code interview questions  J2SE Code Interview Questions
 J2EE Code interview questions  J2EE Code Interview Questions
 J2ME Code interview questions  J2ME Code Interview Questions
Question
how to store and retrive a set of values without using an 
array
 Question Submitted By :: Kiran
I also faced this Question!!     Rank Answer Posted By  
 
  Re: how to store and retrive a set of values without using an array
Answer
# 1
please post the answer...



thanks and regards
kiran.y
 
Is This Answer Correct ?    1 Yes 3 No
Kiran
 
  Re: how to store and retrive a set of values without using an array
Answer
# 2
link list i think..
 
Is This Answer Correct ?    1 Yes 2 No
Karthik
 
 
 
  Re: how to store and retrive a set of values without using an array
Answer
# 3
I think U need this .......

/*****************************************************/
import java.util.*;
   
class TreeSetDemo {
  public static void main(String args[]) {
    // Create a tree set.
    TreeSet<String> ts = new TreeSet<String>();
   
    // Add elements to the tree set.
    ts.add("C");
    ts.add("A");
    ts.add("B");
    ts.add("E");
    ts.add("F");
    ts.add("D");
   
    System.out.println(ts);
  }
}

/******************************************************/
The output from this program is shown here:
[A, B, C, D, E, F]
/*******************************************************/

/********************************
************   AND   ************
**********************************/



import java.util.*;
   
class HashSetDemo {
  public static void main(String args[]) {
    // Create a hash set.
    HashSet<String> hs = new HashSet<String>();
   
    // Add elements to the hash set.
    hs.add("B");
    hs.add("A");
    hs.add("D");
    hs.add("E");
    hs.add("C");
    hs.add("F");
   
    System.out.println(hs);
  }
}

/**************************************/
The following is the output from this program:
[D, A, F, C, B, E]
/****************************************/
 
Is This Answer Correct ?    0 Yes 0 No
Shiva
 

 
 
 
Other J2SE Code Interview Questions
 
  Question Asked @ Answers
 
inner join,outerjoin,trigger,stored procedure explain with code snippets?  1
How to create and run runnable jar file of a Java Project. HCL1
how to print a message to console without using main() function?(do not use even static blocks also.) Google3
how to store and retrive a set of values without using an array Maximus3
 
For more J2SE Code Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com