1. What will be the output of the program? TreeSet map = new TreeSet(); map.add("one"); map.add("two"); map.add("three"); map.add("four"); map.add("one"); Iterator it = map.iterator(); while (it.hasNext() ) { System.out.print( it.next() + " " ); }





Ask Your Doubts Here

Type in
(Press Ctrl+g to toggle between English and the chosen language)

Comments

  • By: guest on 02 Jun 2017 01.26 am
    TreeSet assures no duplicate entries; also, when it is accessed it will return elements in natural order, which typically means alphabetical.
Show Similar Question And Answers
QA->A word is given in capital letters. It is followed by four words. Out of these four words, three cannot be formed from the letters of the word in capital letters. Point out the word which can be formed from the letters of the given word in capital letters— ARCHITECTURE....
QA->.In the question below three words are given.They are followed by four words one of which stands for the class to which these three words belong.Identify that word:Barbarous,Crude,Rude....
QA->A word given in Capital Letters is followed by four answer words. Out of these only one can be formed by using the letters of the given words. Find out that word— ENVIRONMENT....
QA->A word given in capital letters is followed by four words. Out of these only one cannot be formed by using the letters of the given word. Find out that word— REVOLUTIONARY....
QA->In a road map the scale is 1 cm = 8 km. If there are two places of cm apart is marked in that map. Then the actual distance between that places is :....
MCQ->What will be the output of the program? TreeSet map = new TreeSet(); map.add("one"); map.add("two"); map.add("three"); map.add("four"); map.add("one"); Iterator it = map.iterator(); while (it.hasNext() ) { System.out.print( it.next() + " " ); }....
MCQ->/ Missing statements ? / public class NewTreeSet extends java.util.TreeSet { public static void main(String [] args) { java.util.TreeSet t = new java.util.TreeSet(); t.clear(); } public void clear() { TreeMap m = new TreeMap(); m.clear(); } } which two statements, added independently at beginning of the program, allow the code to compile? No statement is required import java.util.; import.java.util.Tree; import java.util.TreeSet; import java.util.TreeMap;....
MCQ->What will be the output of the program? import java.util.; class I { public static void main (String[] args) { Object i = new ArrayList().iterator(); System.out.print((i instanceof List)+","); System.out.print((i instanceof Iterator)+","); System.out.print(i instanceof ListIterator); } }....
MCQ->What will be the output of the program? public class X { public static void main(String [] args) { try { badMethod(); System.out.print("A"); } catch (RuntimeException ex) / Line 10 / { System.out.print("B"); } catch (Exception ex1) { System.out.print("C"); } finally { System.out.print("D"); } System.out.print("E"); } public static void badMethod() { throw new RuntimeException(); } }....
MCQ->What will be the output of the program? public class Test { public static void main(String[] args) { final StringBuffer a = new StringBuffer(); final StringBuffer b = new StringBuffer(); new Thread() { public void run() { System.out.print(a.append("A")); synchronized(b) { System.out.print(b.append("B")); } } }.start(); new Thread() { public void run() { System.out.print(b.append("C")); synchronized(a) { System.out.print(a.append("D")); } } }.start(); } }....
Terms And Service:We do not guarantee the accuracy of available data ..We Provide Information On Public Data.. Please consult an expert before using this data for commercial or personal use | Powered By:Omega Web Solutions
© 2002-2017 Omega Education PVT LTD...Privacy | Terms And Conditions
Question ANSWER With Solution