We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents c94e213 + d616006 commit ae7acbfCopy full SHA for ae7acbf
src/reflection/invoke_a_method.md
@@ -37,7 +37,7 @@ class Tea {
37
```
38
39
For static methods you do not need an instance of the class to invoke them.
40
-Instead you need to pass the class itself as the first argument to `.invoke`.
+Instead, the first argument is ignored. You can pass `null`.
41
42
```java
43
import java.lang.reflect.InvocationTargetException;
@@ -55,8 +55,8 @@ class Main {
55
throw new RuntimeException(e);
56
}
57
58
- biteMethod.invoke(Apple.class, 5);
59
- biteMethod.invoke(Apple.class, 1);
+ biteMethod.invoke(null, 5);
+ biteMethod.invoke(null, 1);
60
61
62
0 commit comments