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. class A{
  13. public LinkedHashSet<Long> set = new HashSet<>();
  14.  
  15. public long get(long index){
  16. return set.get(index);
  17. }
  18.  
  19. public void put(int value){
  20. set.put(value);
  21. }
  22. }
  23. }
  24. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:13: error: incompatible types: cannot infer type arguments for HashSet<>
	public LinkedHashSet<Long> set = new HashSet<>();
	                                            ^
    reason: no instance(s) of type variable(s) E exist so that HashSet<E> conforms to LinkedHashSet<Long>
  where E is a type-variable:
    E extends Object declared in class HashSet
Main.java:16: error: cannot find symbol
		return set.get(index);	
		          ^
  symbol:   method get(long)
  location: variable set of type LinkedHashSet<Long>
Main.java:20: error: cannot find symbol
		set.put(value);
		   ^
  symbol:   method put(int)
  location: variable set of type LinkedHashSet<Long>
3 errors
stdout
Standard output is empty