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                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
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 ?    2 Yes 5 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 ?    2 Yes 4 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 ?    4 Yes 4 No
Shiva
 
  Re: how to store and retrive a set of values without using an array
Answer
# 4
using
BufferedReadered br=new BufferedReader(new InputStreamReader
(System.in));
while (br.readline)
System.out.println(br); 



















B
 
Is This Answer Correct ?    0 Yes 2 No
Ashok Kumar
 

 
 
 
Other J2SE Code Interview Questions
 
  Question Asked @ Answers
 
How to create and run runnable jar file of a Java Project. HCL3
how to print a message to console without using main() function?(do not use even static blocks also.) Google6
How can we get the details for printing the employee details at run time using JDBC connectivity? can u provide the coding for that? Its urgent?  1
how to store and retrive a set of values without using an array Maximus4
inner join,outerjoin,trigger,stored procedure explain with code snippets?  1
 
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