Getting Superclass

Report a typo

Implement the two methods: getSuperClassByName and getSuperClassByInstance.

getSuperClassByInstance accepts one argument, the instance of objects. The method should return the superclass of the given object.
getSuperClassByName accepts one argument, string name of the class. It should return the superclass of the class with the name as in parameter.

Write a program in Java 17
class SuperClassGetter {

public Class getSuperClassByName(String name) throws ClassNotFoundException {
// write your code here
}

public Class getSuperClassByInstance(Object object) {
// write your code here
}
}
___

Create a free account to access the full topic