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
- What is the primary purpose of a system call?
- Which of the following is a common technique used in debugging to systematically narrow down the location of a bug?
- Consider three processes P1, P2, P3 with burst times 10, 5, 8 milliseconds respectively. All arrive at time 0. If they are scheduled using the Shortest Job...
- If elements are inserted into a Binary Search Tree in strictly ascending order (e.g., 1, 2, 3, 4, 5), what will be the resulting structure of the tree?
- Consider a Quick Sort implementation where the pivot is always chosen as the last element. If the input array is already sorted in ascending order, what is...
- Which of the following algorithm uses Darwinian based algorithm to find the best solutions to solve complicated problems with a greater number of variables...
- In Kubernetes, which storage type remains available even if the pod is deleted and recreated on a different node?
- Cocomo (Constructive Cost Model) is a regression model based on LOC where LOC is :
- State True or False Semi-structured data is data that does not conform to a data model but has some structure. It lacks a fixed or rigid schema. It is th...
- In a Max-Heap, what is the relationship between a parent node and its children?
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