s-day02-泛型方法的使用

This commit is contained in:
2026-07-31 10:53:15 +08:00
parent af6120ea2f
commit e6ac76cd25
8 changed files with 73 additions and 10 deletions
@@ -0,0 +1,21 @@
package com.inmind.generic_method06;
public class Demo09 {
public static void main(String[] args) {
//手机工厂
Factory<Phone> phoneFactory = new Factory<>();
Phone phone = new Phone();
Phone fixedPhone = phoneFactory.fix(phone);
/*
得到 二维码小卡片,发现这个师傅修得很好,这个师傅说其实我很多都能修,不仅是手机
*/
Pad pad = new Pad();
Pad fixedPad = phoneFactory.fixAll(pad);
Phone fixedPhone1 = phoneFactory.fixAll(phone);
fixedPad.playApp();
fixedPhone1.call();
}
}