Implement getNumberOfFieldsClassDeclares method to count the number of fields declared in a class. You should count public, protected, default (package) access, and private fields, excluding inherited fields.
Reflection basics
Declared fields
Report a typo
Write a program in Java 17
/**
Get number of fields class declares (the ones inherited should be excluded).
*/
class FieldGetter {
public int getNumberOfFieldsClassDeclares(Class<?> clazz) {
// 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.