This commit is contained in:
xiongraorao
2018-09-06 10:00:51 +08:00
parent d7d4bdc084
commit d77e9f903b
5 changed files with 127 additions and 1 deletions

View File

@ -0,0 +1,17 @@
package com.raorao.java.oop;
/**
* 子类.
*
* @author Xiong Raorao
* @since 2018-09-06-9:27
*/
public class Children extends Father {
int sum = 2;
int chlid = 3;
public void say() {
System.out.println("this is children say!");
}
}

View File

@ -0,0 +1,16 @@
package com.raorao.java.oop;
/**
* 测试.
*
* @author Xiong Raorao
* @since 2018-09-06-9:28
*/
public class Client {
public static void main(String[] args) {
Father f = new Children();
System.out.println(f.num);
f.say();
}
}

View File

@ -0,0 +1,16 @@
package com.raorao.java.oop;
/**
* 父类.
*
* @author Xiong Raorao
* @since 2018-09-06-9:26
*/
public class Father {
int num = 1;
public void say(){
System.out.println("this is father say!");
}
}