Add the following elements using LinkedHashSet class object ?

 


Add the following elements using LinkedHashSet class object:

a          b          d         n         s          f          g         e         w

Display the list

program

    import java.util.LinkedHashSet;
    public class linkhas{
    public static void main(String args[]){
        LinkedHashSet<String>lhset=new LinkedHashSet<String>();
        lhset.add("a");
        lhset.add("b");
        lhset.add("d");
        lhset.add("n");
        lhset.add("s");
        lhset.add("f");
        lhset.add("g");
        lhset.add("e");
        lhset.add("w");
   System.out.println(lhset);
  }
}

output

[a,b,d,n,s,f,g,e,w]

0 Comments

Post a Comment

Post a Comment (0)

Previous Post Next Post