Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/reflection/invoke_a_method.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Tea {
```

For static methods you do not need an instance of the class to invoke them.
Instead you need to pass the class itself as the first argument to `.invoke`.
Instead, the first argument is ignored. You can pass `null`.

```java
import java.lang.reflect.InvocationTargetException;
Expand All @@ -55,8 +55,8 @@ class Main {
throw new RuntimeException(e);
}

biteMethod.invoke(Apple.class, 5);
biteMethod.invoke(Apple.class, 1);
biteMethod.invoke(null, 5);
biteMethod.invoke(null, 1);
}
}

Expand Down