MagnusCaligo
MagnusCaligo

Reputation: 707

How do you fill the parameters Class<? extends 'some class'>?

I was looking at some code online to help me with a problem and I found this interesting method (which fixed my problem) however it has these parameters

 public void showScene(Class<? extends AbstractScene> sceneClazz) {

After doing some research and using logic I figured out that it was just taking a class as a parameter that extends AbstractScene.... However, I want to know how to call this method again

I have tried multiple ways of calling it such as

showScene(new GameActivity());
showScene(GameActivity<? extends AbstractScene>());

but none of these work... How do I call this method?

Upvotes: 0

Views: 69

Answers (1)

August
August

Reputation: 12558

You can use a class literal, for instance:

showScene(GameActivity.class);

Any type of class that extends (or implements) AbstractScene will work.

Upvotes: 5

Related Questions