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
- Method overriding is an example of which type of polymorphism?
- What is the average-case time complexity for search, insertion, and deletion operations in a well-designed hash table?
- Which of the following statements accurately describes Third Normal Form (3NF) in database normalization?
- Which of the following protocols is used to reliably transfer a file over an insecure channel and provides authentication and encryption?
- An insert(root, value) function for a Binary Search Tree (BST) is implemented recursively. After inserting several elements, a search(root, value) function...
- 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...
- When evaluating the performance of an algorithm, which of the following factors is generally considered most important for large input sizes?
- Which heuristic function property ensures A* algorithm finds an optimal path?
- Which of the following is the last part of ICMP message format?
- What is the primary disadvantage of using an array as a data structure?
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