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.
Retrieving Class instances
Getting Superclass
Report a typo
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
}
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.