摘要: package com.interfaces; public class Demo3 { public static void main(String[] args) { test((name, age) -> new Student(name,age)); test(Student::new); 阅读全文
posted @ 2022-04-23 20:40 phpwyl 阅读(62) 评论(0) 推荐(0) 编辑
摘要: package com.interfaces; public class PrinterDemo { public static void main(String[] args) { usePrinter((String s)->{ System.out.println(s.toUpperCase( 阅读全文
posted @ 2022-04-23 17:55 phpwyl 阅读(73) 评论(0) 推荐(0) 编辑
摘要: package com.interfaces; public class Demo2 { public static void main(String[] args) { start(s-> Integer.parseInt(s)); //引用类方法 start( Integer::parseInt 阅读全文
posted @ 2022-04-23 17:42 phpwyl 阅读(9) 评论(0) 推荐(0) 编辑
摘要: package com.interfaces; public interface Inter { void show(); default void method(){ System.out.println("默认方法"); } public static void test(){ System.o 阅读全文
posted @ 2022-04-23 11:51 phpwyl 阅读(973) 评论(0) 推荐(0) 编辑
摘要: package com.interfaces; public interface InterfaceOne { void aa(); void bb(); default void cc(){ } } 默认方法不是抽象方法,所以不被强制重写,但可以被重写,重写时候要去掉default关键字 publ 阅读全文
posted @ 2022-04-23 09:42 phpwyl 阅读(183) 评论(0) 推荐(0) 编辑