Java - What is the output: class literal?

Question

What is the output of the following code?

class Test{}
public class Main{
  public static void main(String[] argv) {
    Test test = new Test();
    Class<Test> testClass = test.class;
    System.out.println(testClass);
    
  }
}


Click to view the answer

Test test = new Test();
Class testClass = test.class; // A compile-time error. Must use Test.class

Note

class literal is used with a class name, not with an object reference.