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. Entity entity1 = new Entity();
  13. entity1.carId = 1;
  14. entity1.tableKind = 2;
  15.  
  16. Entity entity2 = new Entity();
  17. entity2.carId = 2;
  18. entity2.tableKind = 3;
  19.  
  20. List<Entity> list = new ArrayList<>();
  21. list.add(entity1);
  22. list.add(entity2);
  23.  
  24. int index = list.indexOf(1);
  25. Systemout.println(index);
  26.  
  27. }
  28.  
  29. public class Entity {
  30. long carId;
  31. int tableKind;
  32. }
  33. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:12: error: non-static variable this cannot be referenced from a static context
		Entity entity1 = new Entity();
		                 ^
Main.java:16: error: non-static variable this cannot be referenced from a static context
		Entity entity2 = new Entity();
		                 ^
Main.java:25: error: cannot find symbol
		Systemout.println(index);
		^
  symbol:   variable Systemout
  location: class Ideone
3 errors
stdout
Standard output is empty