What does .class mean after a class name

SomeClass.class gets the Class<SomeClass> type which you can use for programming using the reflection API.

You can get the same type if you have an instance of the class using instance.getClass().

You can check out the documentation here. For example, you can:

  • get the names of fields and methods, annotations, etc.
  • invoke methods, get constructor to create new instances of the class
  • get the name of the class, the superclass, package, etc

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)