Question

Write a java program to demonstrate constructor overloading, method overloading and method overriding. Make necessary assumptions. 

13 Sep 2024
Answer :
Word Count : 636

Sure! Here’s a Java program demonstrating constructor overloading, method overloading, and method overriding. We’ll use a simple example involving a base class `Shape` and two derived classes `Circle` and `Rectangle`. Each class will illustrate these concepts.

```java
// Base class
class Shape {
    private String color;
    private int sides;

    // Constructor overloading
    public Shape() {
        this.color = "Unknown";
        this.sides = 0;
    }

    public Shape(String color) {
        this.color = color;
        this.sides = 0;
    }

    public Shape(String color, int sides) {
       

_______ __________ _______ ________ ________ _________ ____ ___ _____ _________ ______.
_____ _______ ___ ______ ________ ________ ___ _________ _____.
___ __________ ____ ________ ________ ________ ____ ____ _______ _____ _______.
_______ _____ _______ ___ _________ ____ ___.
______ ____ ______ _______ ______ ___ ______ _________.
__________ _________ _______ _________ ____ _____ _________.
__________ ____ _____ ____ ___ ________ ________ ____.
__________ ________ ________ _________ ______ _____ ____ _______ _______ _________ ______.
_________ _________ ______ _________ ________ _______ ______ __________.
_______ __________ ______ ________ _______ ____.
_______ _____ _____ ______ ______ __________ ____ _______.
______ __________ ________ ________ _______ __________ ____ ______ _______ _____ _______.
____ __________ _____ _____ __________ ___ _________ _______ _____.
____ ___ _________ _________ _________.
_________ _______ _________ __________ _______ __________ _______.
____ _____ ________ ______ ______.
__________ ____ _____ ________ ___ _____ ______.
____ _______ _____ ___ _______ ________ ___ _______ ________ ____ ______.
____ _______ _____ ________ ________ _____ __________ _________ ____ _______ ____.
_______ _________ ___ __________ ______ ____ _________ ______ ______ ____ _______ _____.
__________ ____ ____ _____ _____ ______ _________ ______ ______.
________ _________ ___ __________ ______ ___ ____ ________ ________.
______ ________ __________ _______ ________ _________.
_________ ______ _________ _____ __________ ________.
______ _______ ________ _________ _________ ________ _____ _________.
_______ _________ ______ _________ ________ _______.
_________ ______ ________ _________ __________ _______ _____ ___ ____.
_________ ___ ________ ________ __________ _______.
___ ____ __________ __________ _____ _______ _______ ____ ____ ____.
________ _____ _____ _______ _______ ____ ______ ________ ____.
________ _________ ___ __________ ___.
__________ ______ _____ _______ ________ _____.
__________ _____ ___ ___ _________.
________ _____ ___ __________ ______ _________ ____ _____ ____ ___.
___ _________ _________ _________ _____ ________.
_________ _________ ______ _________ ___ _________ ___ _________.
______ _____ ________ _________ ___ _______.
________ __________ __________ _________ _______.
________ ______ _______ _________ ___ ______ ___.
_____ __________ ___ __________ ____.
___ ____ _______ _______ _____ ______ __________ _____ ______ _______.
_________ ________ __________ ________ _________ ____ ____.
____ ______ ___ _________ _____ __________ _____ ___ _______ ___ _____.
_________ _________ _____ ___ _________ ____ ___ _____ _______ _______ _______ ______.
___ _________ _________ ________ ____ ___.
_____ __________ ______ ___ _______ ________ ___ _______ _______ ________.
___ ______ ______ ____ ____ ___ _________ __________ _________ ________ ______.
___ _____ _________ __________ ___ _____.
__________ ______ ______ ______ ________ __________.
_____ ______ ________ __________ ____ ____ __________.
_______ __________ ______ __________ _____ __________ ______.
______ _____ _________ __________ _______ ________ ___.
________ __________ ________ ____ ____ _______.
___ _______ _______ ___ __________ ______ ______ _________ ______ ______ __________ ________.
____ ___ ______ __________ ______ ________ ________ ____ ________ ____ _________ _________.
________ __________ _____ ______ _____ ___ _________.
______ ____ ________ _______ ___ ________ _________ ___ ___ ________.
_____ ____ ___ ___ ________ ___ _____ _______ ______ ______.
_____ ______ _____ ___ ________ ________ ____ ________ _____ __________.
_____ _______ __________ _____ ___.
____ __________ _________ ________ ____ _____ ________ ____ __________ ______.
_____ _______ __________ ____ _______ _______ _____ ___ _______ _________ ________ ________.
__________ ________.
IGNOU ACADEMY
Your IGNOU journey, made easier.
  • Solved Assignments
  • Study Notes
  • Guess Papers
  • Question Papers
Skip in 10
Top
📞
Call Support Instant phone assistance IGNOU MCSL 210 2024 2025 - Write a java program to demonstrate constructor overloading, method ov | IGNOU Academy
→
🟢
WhatsApp Chat Fast live messaging
→
Email Us Business enquiries & support
→