Implement the getFieldsContainingAnnotations method that lists the names of the fields declared in the object. The list should include all the fields containing at least one annotation. Fields inherited from parent classes should be omitted.
Computer scienceProgramming languagesJavaCode organizationObject-oriented programmingOther conceptsAnnotations
Detecting annotations
Annotated fields
Report a typo
Write a program in Java 17
import java.lang.reflect.*;
/**
Get an array of fields the object declares that contain annotations (inherited fields should be skipped).
*/
class AnnotationsUtil {
public static String[] getFieldsContainingAnnotations(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.