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
- Which of the following statements best describes the concept of a computing model in computer science?
- Which of the following is a property of an admissible heuristic in A* search?
- Consider the following Java code: import java.util.Arrays; public class Splitter { public static void main(String[] args) { String data...
- A Python function get_element(arr, index) is supposed to return the element at a given index. def get_element(arr, index): # Assume arr is a list of ...
- How do you correctly create a new Map object in JavaScript?
- In a Breadth-First Search (BFS) algorithm for graph traversal, what is the primary role of a queue?
- Bourne-style shells uses which below symbol
- In a backtracking algorithm, what happens when a partial solution is found to violate a constraint?
- What is the outpur of the following part of python program? s="india" 1=0 for x in s: if(X!="i"): 1=1+1 else: pass print(1)
- Which of the following is NOT part of CIA triad?
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)