From c090a72264c565382ddb4b2d4f523a7532209cf9 Mon Sep 17 00:00:00 2001 From: zeekling Date: Sun, 16 May 2021 18:11:35 +0800 Subject: [PATCH] ThreadTest,ExtendsTest --- .../java/com/zeekling/exten/ExtendsTest.java | 36 +++++++++++++++++++ .../java/com/zeekling/thread/ThreadTest.java | 25 +++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 src/main/java/com/zeekling/exten/ExtendsTest.java create mode 100644 src/main/java/com/zeekling/thread/ThreadTest.java diff --git a/src/main/java/com/zeekling/exten/ExtendsTest.java b/src/main/java/com/zeekling/exten/ExtendsTest.java new file mode 100644 index 0000000..ef69307 --- /dev/null +++ b/src/main/java/com/zeekling/exten/ExtendsTest.java @@ -0,0 +1,36 @@ +package com.zeekling.exten; + +/** + * @author zeekling + * @apiNote https://www.nowcoder.com/question/next?pid=30695833&qid=15977&tid=44372102 + * @since 2021-05-16 + */ +public class ExtendsTest { + + public static void main(String[] args) { + Base base = new Son(); + base.method(); + //base.methodB(); + } + +} + +class Base +{ + public void method() + { + System.out.println("Base"); + } +} +class Son extends Base +{ + public void method() + { + System.out.println("Son"); + } + + public void methodB() + { + System.out.println("SonB"); + } +} diff --git a/src/main/java/com/zeekling/thread/ThreadTest.java b/src/main/java/com/zeekling/thread/ThreadTest.java new file mode 100644 index 0000000..54786dc --- /dev/null +++ b/src/main/java/com/zeekling/thread/ThreadTest.java @@ -0,0 +1,25 @@ +package com.zeekling.thread; + +/** + * @author zeekling + * @apiNote https://www.nowcoder.com/question/next?pid=30695833&qid=4339&tid=44372102 + * @since 2021-05-16 + */ +public class ThreadTest { + + public static void main(String args[]) { + Thread t = new Thread() { + public void run() { + dianping(); + + } + }; + t.run(); + System.out.print("dazhong"); + } + + static void dianping() { + System.out.print("dianping"); + } + +}