Given the declaration:
In which two locations is it legal to apply the @Resource annotation? (Choose two.)
Given the declaration:
In which two locations is it legal to apply the @Resource annotation? (Choose two.)
Given the declaration with @Target({TYPE, METHOD}), the @Resource annotation can be legally applied to types (e.g., classes) and methods. Therefore, the legal locations to apply the @Resource annotation are at the class declaration and on methods. Loc1 represents the class declaration, and Loc4 represents a method. Therefore, @Resource can be applied at Loc1 and Loc4.
annotation cannot use after extends clause even if is target type, only before class