Real class type is not set properly in Java

Not every time a real type of a class is set using getClass method. It is better to rely on getting class from a field than getting from this reference.