mardi 30 juin 2020

Why are braces inserted in the code to call the getType method of TypeToken? [duplicate]

Why are there braces {} in the following code

Type type = new TypeToken<ArrayList<ExampleItem>>() {}.getType();

If I understand correctly the normal Java syntax would be ClassName().MethodName(). Why are a space and the braces inserted between the class constructor and the getType method?





Aucun commentaire:

Enregistrer un commentaire