Can someone explain to me,
why passing a non-static method-reference to method File::isHidden
is ok,
but passing method reference to a non-static method MyCass::mymethod
- gives me a
"Cannot make a static reference to the non-static method" ?
public static void main(String[] args) {
File[] files = new File("C:").listFiles(File::isHidden); // OK
test(MyCass::mymethod); // Cannot make a static reference to the non-static method
}
static interface FunctionalInterface{
boolean function(String file);
}
class MyCass{
boolean mymethod(String input){
return true;
}
}
// HELPER
public static void test(FunctionalInterface functionalInterface){}