I have a class that extends to another class and that class extends to another class.
class 1 extends class 2 class 2 extends class 3 class 3 extends class
You can use getSuperclass() up to the Object.
Object
But read the doc first to understand what it returns in the case of interfaces etc. There are more methods to play with on the same page.