CODEBANK-4 测试 Default 关键字

This commit is contained in:
YuCheng Hu 2023-10-28 01:13:14 -04:00
parent f899e569fd
commit d315f812a5
No known key found for this signature in database
GPG Key ID: 942395299055675C
1 changed files with 24 additions and 11 deletions

View File

@ -12,21 +12,34 @@ import java.util.Properties;
* *
* @author YuCheng Hu * @author YuCheng Hu
*/ */
public class Main {
interface TestInterface1 {
// default method
default void show() {
System.out.println("Default TestInterface - 1 ");
}
}
interface TestInterface2 {
// Default method
default void show() {
System.out.println("Default TestInterface - 2");
}
}
public class Main implements TestInterface1, TestInterface2 {
private static final Logger logger = LoggerFactory.getLogger(Main.class); private static final Logger logger = LoggerFactory.getLogger(Main.class);
private static Options options = new Options();
private static Properties properties = new Properties();
private static CommandLine cl = null;
private static boolean dryRun = false;
private static int limit = 0;
private static boolean force = false;
public static void main(String[] args) { public static void main(String[] args) {
new Main().show();
} }
@Override
public void show() {
TestInterface1.super.show();
TestInterface2.super.show();
}
} }