Java - InterfacesWhich of the following is TRUE about default methods in Java interfaces?ADefault methods can have private access modifier.BDefault methods can be overridden by implementing classes.CDefault methods must be abstract.DDefault methods cannot call other interface methods.Check Answer
Step-by-Step SolutionSolution:Step 1: Recall default method propertiesDefault methods provide a body and can be overridden by classes implementing the interface.Step 2: Evaluate each optionPrivate access is not allowed for default methods; they are implicitly public. They are not abstract. They can call other interface methods.Final Answer:Default methods can be overridden by implementing classes. -> Option BQuick Check:Overriding default methods = Allowed [OK]Quick Trick: Default methods are concrete and overridable [OK]Common Mistakes:Confusing default methods with abstract methodsThinking default methods can be private
Master "Interfaces" in Java9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Java Quizzes Abstraction - Abstract classes - Quiz 12easy Classes and Objects - Instance methods - Quiz 15hard Classes and Objects - Object interaction - Quiz 13medium Classes and Objects - Object interaction - Quiz 5medium Constructors - Default constructor - Quiz 15hard Constructors - This keyword usage - Quiz 11easy Custom Exceptions - Best practices - Quiz 1easy Exception Handling - Checked vs unchecked exceptions - Quiz 4medium Inheritance - Why inheritance is used - Quiz 6medium Interfaces - Static methods in interfaces - Quiz 15hard