What is wrong with the following interface? public interface House { @Deprecated
ID: 3890480 • Letter: W
Question
What is wrong with the following interface?
public interface House {
@Deprecated
void open();
void openFrontDoor();
void openBackDoor();}
2- Consider this implementation of the House interface, shown in Question 1.
public class MyHouse implements House {
public void open() {}
public void openFrontDoor() {}
public void openBackDoor() {}
}
If you compile this program, the compiler produces a warning because open was deprecated (in the interface). What can you do to get rid of that warning?
3- Will the following code compile without error? Why or why not?
public @interface Meal { ... }
@Meal("breakfast", mainDish="cereal")
@Meal("lunch", mainDish="pizza")
@Meal("dinner", mainDish="salad")public void evaluateDiet() { ... }
4- Define an annotation type for an enhancement request with elements id, synopsis, engineer, and date. Specify the default value as unassigned for engineer and unknown for date.
Explanation / Answer
Hi friend I have answered first two questions.
Please repost other in separate post.
Please let me know in case of any issue in first 2.
1)
way to a deprecation of a method in an interface which will prevent implementation of the method
So we can not Deprecated method in interface
2)
use: javac -Xlint:deprecation MyHouse.java command to compile
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.