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. ArrayList<String> sam;
  13. sam = new ArrayList<String>();
  14. sam.add( "ben" );
  15. sam.add( 0, "wil" );
  16. sam.set( 1, "cat" );
  17. sam.add( 1, "dog" );
  18. sam.add( "pig" );
  19. sam.remove(2);
  20. sam.set(1, "up");
  21. System.out.println( sam.contains("sam") );
  22. }
  23. }
Success #stdin #stdout 0.08s 50836KB
stdin
Standard input is empty
stdout
false