import java.util.List;
import java.util.function.*;
interface SomeTest <T>
{
boolean test(T n, T m);
}
class MyClass <T>
{
boolean myGenMeth(T x, T y)
{
boolean result = false;
// ...
return result;
}
}
class Timepass
{
public static void main(String args[])
{
SomeTest <Integer> mRef = MyClass <Integer> :: myGenMeth; //Statement 1
Predicate <List<String>> p = List<String> :: isEmpty; //Statement 2
}
}
My query
In the above code, Statement 1
produces two compile time errors
1- Can not find method
myGenMeth(Integer, Integer)
2- Non static method
myGenMeth(T, T)
can not be referenced from static context
Where as, Statement 2
shows no error.
1- What is the difference between Statement 1
and Statement 2
??