Java | Operators | Question 6
class Base {} class Derived extends Base { public static void main(String args[]){ Base a = new Derived(); System.out.println(a instanceof Derived); } } |
chevron_right
filter_none
(A) true
(B) false
Answer: (A)
Explanation: The instanceof operator works even when the reference is of base class type.
Quiz of this Question
Recommended Posts:
- Java | Operators | Question 1
- Java | Operators | Question 3
- Java | Operators | Question 4
- Java | Operators | Question 5
- Java | Operators | Question 7
- Java | Operators | Question 8
- Java | Operators | Question 9
- Java | Operators | Question 2
- Operators in Java
- Bitwise operators in Java
- Compound assignment operators in Java
- Bitwise right shift operators in Java
- Operators in C | Set 2 (Relational and Logical Operators)
- C | Operators | Question 17
- C | Operators | Question 11



