s-day02-泛型方法的使用
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user