fork(1) 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. ArrayList<Long> l = new ArrayList<Long>();
  13. long l1 = 100;
  14. long l2 = 200;
  15. int l3 = 300;
  16. l.add(l1);
  17. l.add(l2);
  18. // l.add(l3); // ランタイムエラー
  19. Long y = new Long(200);
  20. System.out.println(l.contains(y)); // true
  21. long y2 = 100;
  22. System.out.println(l.contains(y2)); // true
  23. int y3 = 100;
  24. System.out.println(l.contains(y3)); // false
  25. // System.out.println((Long)y3); コンパイルエラー
  26. System.out.println(y2 == y3); // true
  27. }
  28. }
Success #stdin #stdout 0.09s 320320KB
stdin
Standard input is empty
stdout
true
true
false
true