Implement the getPublicFields method that returns String array with names of public fields declared in the class object belongs to. Fields inherited from parent classes should be omitted.
Dealing with modifiers
List public fields
Report a typo
Write a program in Java 17
/**
Get list of public fields the object declares (inherited fields should be skipped).
*/
class FieldGetter {
public String[] getPublicFields(Object object) {
// Add implementation 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.