Sunday, 27 April 2014

TreeSet : toString : Returns a string representation of this collection

public String toString()
Returns a string representation of this collection. 

import java.util.*;
class TreeSetToString{
 public static void main(String args[]){
  TreeSet<Double> mySet = new TreeSet<> ();
  
  /* Add Elements to the Set */
  mySet.add(55.6);
  mySet.add(10.01);
  
  System.out.println(mySet.toString());
 }
}

Output
[10.01, 55.6]


 

Prevoius                                                 Next                                                 Home

No comments:

Post a Comment