Question
.Consider the following Java code: class Shape { void draw() { System.out.println("Drawing a generic shape"); } } class Circle extends Shape { @Override void draw() { System.out.println("Drawing a circle"); } } class Rectangle extends Shape { @Override void draw() { System.out.println("Drawing a rectangle"); } } public class TestPolymorphism { public static void main(String[] args) { Shape s1 = new Circle(); Shape s2 = new Rectangle(); Shape s3 = new Shape(); s1.draw(); s2.draw(); s3.draw(); } } What will be the output of this code?
More IT Operating System Questions
- Consider the following Java code snippet: import java.util.Collections; import java.util.PriorityQueue; public class HeapQuestion2 { ...
- Which device operates at the Data Link Layer and uses MAC addresses to forward frames only to the intended recipient port?
- What happens when you try to compile the following code? abstract class Shape { abstract void draw(); } public class Test { ...
- Consider a Java method printList(Node head) for a singly linked list. class Node { int data; Node next; Node(int d) { data = d; next = null...
- In the context of IP addressing, what does CIDR notation like 192.168.1.0/24 represent?
- In Kubernetes, which storage type remains available even if the pod is deleted and recreated on a different node?
- A queue initially empty undergoes the following sequence of operations: 1. enqueue(10) 2. enqueue(20) 3. dequeue() 4. enqueue(30) 5. dequeue() 6...
- Which of one the below options are the two different types of bus topology ?
- A priority scheduling system suffers from starvation of low-priority processes. Which technique specifically addresses this?
- Which of the following statement is TRUE related to Alpha Beta pruning algorithm?
Hey! Ask a query
Please enter email id
The email must be a valid email address.
Please enter Mobile Number
Please enter valid Mobile Number
Please enter your Doubt
Think You're Ready for RBI Grade B?
RBI Grade B 2026 Phase 1 Memory Based Paper
- 200 Questions with Detailed Solutions
- Section-wise Coverage (GA, English, Quant & Reasoning)