day09-继承中方法的覆盖重写_应用场景
This commit is contained in:
15
day09/src/com/inmind/extends_override03/test/Demo04.java
Normal file
15
day09/src/com/inmind/extends_override03/test/Demo04.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package com.inmind.extends_override03.test;
|
||||
/*
|
||||
重写的应用场景:手机
|
||||
重写的意义:对于父类中方法的功能的扩展
|
||||
*/
|
||||
public class Demo04 {
|
||||
public static void main(String[] args) {
|
||||
//买新旧手机,感受下重写的效果
|
||||
Phone phone = new Phone();
|
||||
phone.show();
|
||||
System.out.println("-------");
|
||||
NewPhone newPhone = new NewPhone();
|
||||
newPhone.show();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user