【发布时间】:2017-10-02 01:31:42
【问题描述】:
来自https://stackoverflow.com/a/1079799
Java 在设计上不适合鸭式打字。您可能选择的方式 做它是反射:
public void doSomething(Object obj) throws Exception { obj.getClass().getMethod("getName", new Class<?>[] {}).invoke(obj); }
new Class<?>[] {} 是什么意思?谢谢。
【问题讨论】:
-
同
new Class<?>[0]....
标签: java