Java SE 11 Developer (1Z0-819) — Question 206
Which two statements are true about a class that is marked @Deprecated? (Choose two.)
Answer options
- A. Using the class will cause the Java compiler to give a warning.
- B. The class cannot be extended.
- C. The author of the class wants to discourage people from using the class in any way.
- D. There is always another class that can be used instead of the deprecated class.
- E. Using the class is guaranteed to cause errors at runtime.
Correct answer: A, C
Explanation
Option A is correct because marking a class as @Deprecated issues a warning from the compiler to inform developers not to use it. Option C is also correct as the purpose of the @Deprecated annotation is to signal that the author discourages its use. Options B, D, and E are incorrect; a deprecated class can still be extended, there may not always be a replacement class, and using a deprecated class does not guarantee runtime errors.