Java - What is the output: class literal?


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;

Click to view the answer

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


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