fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12.  
  13. { boolean[] b = new boolean[5];
  14. Set s = new HashSet();
  15. b[0]=s.add(new Integer(2));
  16. b[1]=s.add(new Integer(2));
  17.  
  18. System.out.println("Using Hashset Integers b0 = "+b[0]+" and b1 = "+b[1]);
  19. }
  20.  
  21. {
  22. boolean[] b=new boolean[5];
  23. Set s=new HashSet();
  24. b[0]=s.add(2);
  25. b[1]=s.add(2);
  26. System.out.println("Using Hashset int b0 = "+b[0]+" and b1 = "+b[1]);
  27. }
  28.  
  29.  
  30. }
  31. }
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
Using Hashset Integers b0 = true and b1 = false
Using Hashset int b0 = true and b1 = false