class Test { { Runnable b = Test :: length; Comparable c = Test :: length; Comparable c1 = Test :: length; } public static Integer length(String s) { return s.length(); } interface Bar { Integer _(String s); } } class Test1 { { Runnable b = Test1 :: length; Comparable c = Test1 :: length; Comparable c1 = Test1 :: length; } public static Integer length(String s) { return s.length(); } public static Integer length(Integer s) { return s; } interface Bar { Integer _(String s); } } class Test2 { void foo(Integer i) {} Object o = Test2::foo; }