ThreadTest,ExtendsTest
This commit is contained in:
parent
a2d416fdd2
commit
c090a72264
36
src/main/java/com/zeekling/exten/ExtendsTest.java
Normal file
36
src/main/java/com/zeekling/exten/ExtendsTest.java
Normal file
@ -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");
|
||||
}
|
||||
}
|
25
src/main/java/com/zeekling/thread/ThreadTest.java
Normal file
25
src/main/java/com/zeekling/thread/ThreadTest.java
Normal file
@ -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");
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user