[Solved] What is difference between Class class object and object of a class in Java? [duplicate]


Class is something like template or map that you can use to create product. Object at other hand is a product created based on that template.

For example you can have Car template, this template isn’t a car and you can’t drive it. It just say how to create new Car.

class Car {
     // some filed or method here
}

But Object of that class is actual car that you can drive.

Car carInstance = new Car(); // here we create carInstance based on Car template (Class)

If access Car class you access it’s template properties, like fields, methods or constructors.

Class<Car> carClass = Car.class;

and for example get it’s fields :

Field [] fields = carClass.getFields();

2

solved What is difference between Class class object and object of a class in Java? [duplicate]