I hava a problem about Java 8 Runnable
.
public static void main(String[] args) {
Runnable r1 = Test::t1;
Runnable r2 = Test::t2;
Runnable r3 = Test::t3;
}
public static void t1() {
}
public static String t2() {
return "abc";
}
public static String t3(String t) {
return t;
}
As the code show, I understand r1
is right and r3
is wrong, but I don't understand why r2
is also right. Can anybody help me understand it?