What is abstract class Answer: An abstract class is a class that is declared using keyword abstract and it may or may not include abstract methods. Abstract classes cannot be instantiated, but they can be subclassed.
How you define Abstract class Answer: By using key word abstract class can be define as abstract class. Please see example below:
When can object reference cast to interface reference Answer: When java class implements interface it can be cast into interface reference. Please see example below:
What modifiers allowed for methods in Interface Answer: Only public & abstract modifiers are permitted. All methods and fields in an interface should be declared in such a way so that they can be invoked from anywhere. Not only from … Continue reading
Can class defined inside Interface Answer: Yes it is possible to define class inside the interface in java but not recommended. Let’s see in example:
Can Interface final possible Answer: No only public & abstract are permitted to define interface in java.
Interface can extend more than one Interface but Class cannot Answer: It is the bad experience from C++ where this is possible but Java does not allow to do this. The another approach for multiple inheritance is that a class … Continue reading
Can Class extend more than one Class Answer: In Java multiple inheritance is not permitted. It was excluded from the language as a design decision, primarily to avoid circular dependencies.
Can Interface extend another Interface Answer: Yes. In java it is possible to expend another interface and inherit all method form it.
Can Interface implement another Interface Answer: Interface can only extends another interface. If you try implements you will see below error: