GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — JavaGeneric/MethodRefGen5.java at main · AvinandanBose/JavaGeneric Expand file tree/ Copy pathMethodRefGen5.javaMore file actions 54 lines (36 loc) · 1.2 KB / Copy pathMethodRefGen5.javaFile metadata and controls54 lines (36 loc) · 1.2 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 interface MethodRefAdd6<T> { int add(int a, int b); } interface MethodRefAdd7<T> { int add(int a, int b); } class MethodRefAddGen5<T> { static int add(int a, int b) { return a + b; } } public class MethodRefGen5<T extends MethodRefAdd6<? super Number> & MethodRefAdd7<? super Number>> { static int add(int a, int b) { return a + b; } static int Add(MethodRefAdd6<Integer> a, int b, int c) { return a.add(b, c); } public static void main(String[] args) { MethodRefAdd6<Integer> a = MethodRefAddGen5::add; int res = a.add(12, 13); System.out.println(res); MethodRefAdd6<Integer> a1 = Integer::sum; int res1 = a1.add(12, 13); System.out.println(res1); Integer sum = Add(Integer::sum, 12, 13); System.out.println(sum); Integer sum2 = Add(MethodRefGen5::add, 12, 13); System.out.println(sum2); Integer sum3 = Add(MethodRefAddGen5::add, 12, 13); System.out.println(sum3); MethodRefAdd7<Integer> a2 = Integer::sum; int res2 = a2.add(12, 13); System.out.println(res2); } } |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |