Question

What is interface? Explain difference between abstract class and interface with the help of example. Write a java program to demonstrate use of interface.

15 Sep 2022
Answer :
Word Count : 1033

In computer science, an interface is a specification of a set of methods that a class should implement. An interface defines a contract for a class, specifying a set of methods that a class must implement in order for it to be considered as conforming to the interface. In other words, an interface defines the behavior that a class must exhibit in order to be considered as fulfilling the interface contract.

Interfaces are typically used to define common functionality that can be shared across multiple classes. This allows for the implementation of polymorphism, which means that objects of different classes can be used interchangeably as long as they implement the same interface.

Interfaces are typically defined using an interface keyword in languages such as Java and C#, or using a protocol keyword in Swift, or in other languages like C++ , C, Python, etc. They often uses "abstract class" as the way to implement interface.

Here is an example of an interface in Java:

interface Shape {
    double getArea();
}

In this example, any class that implements the Shape interface must provide an implementation for the getArea() method.

An interface also serves as a way to define a contract between different components of a system. One component may depend on another component only through the interface, which allows for greater flexibility and makes the system easier to maintain.

In summary an interface is a

___ ______ ______ ____ ______ _____.
____ __________ ____ _______ ____ ________ ______.
_____ ________ _____ ___ ______.
_______ _________ _________ _________ _____ ___ ___ _____ ___ ___.
________ __________ _______ _______ _______ ________ _______.
_________ _____ __________ _________ __________ ______ ___ _________ _____ ____.
_______ ___ __________ _______ _____ __________ ______.
_____ ___ ____ ________ ________ ____ ____ ____.
____ ___ _________ __________ ____ ____.
__________ ________ ______ ________ ___ ________ ____ _____ _________ ____.
________ __________ ________ ___ ________ __________ __________ ________ _________.
_______ _________ ______ _________ _____ ____ _____ ________ ___ _____ _______.
_________ _________ ________ _____ ______ _____ _____ _____ ________ _______ ____ ___.
______ _________ ______ _______ __________ _________ ________ ___ ______ ____ __________ _____.
____ _____ _____ ____ _____ __________ __________ ________ ______ ____.
________ ______ _____ __________ _________.
______ _____ _______ _____ ___ ____.
________ ___ ___ ________ ____ _______ _________ ________ _____.
__________ _______ _____ _________ __________ _____ ________ _______ _____ ______ ____ ______.
______ ______ ______ __________ ______ __________ _______ _______ __________ ___ ____.
_________ ______ _______ __________ _________ ________.
__________ __________ _______ ________ _______ _______ ___ ________ ___.
_______ ____ _____ ______ ___ _________ _________ ______ ___ ______.
__________ _________ ___ _____ _____ _____ _______ ____.
______ ______ ____ ___ ________ _______ _____ __________ ______ ____.
______ ________ _________ __________ ____ _______ __________ ____ __________ ___.
_____ _________ ________ ________ ____.
__________ ______ __________ ________ _______ ______.
___ __________ ____ ________ ____ ____ _____ __________ ________ __________ _____ __________.
_________ _____ ______ _________ _________ ________ _________.
________ _______ ___ ____ ______ _______ ___ _________ _______ ______ _____ _______.
_______ ____ ___ _________ ______.
_____ ______ ________ ________ ____ ______ ________ ___.
__________ _________ ____ ________ _________.
____ __________ ________ __________ ________ ______ _______ ________ ______.
_____ _________ ________ _______ _____ __________ ____ _________.
_____ ____ ____ ___ _______ ____ ______ __________.
____ _____ ______ __________ _______ ___ _____ _________ ______ ____ ____.
____ __________ _________ _________ ____ ______ _________ ___ _____ ____ _________ ____.
_______ ____ _________ _____ __________ __________ ________.
___ ___ _______ __________ _______.
__________ ____ _________ ___ __________ ________ _____ ________ ________.
__________ ________ _____ ________ ________ _______ __________ ________ ______ _________.
___ _____ __________ ________ _________ __________ _____ _____ ________ __________ ____.
___ ___ __________ _________ _____ ___ ___ ___ _________ __________.
________ ______ ______ _______ ________.
_________ _____ ___ __________ ___ _________.
____ _____ ____ ___ ________ _____ ___ ___ ______ __________.
________ ___ ________ _____ __________ ___ ______ _______ ______ _______ ___.
______ _______ __________ ____ ____.
__________ ______ _____ ______ ______ _______ __________ ___ ______ ____.
___ ___ _________ ___ _______ _____ ___ ________ ___ _________ _____ _____.
_____ _________ ________ ______ __________ _________ ____ ____ ___.
________ __________ ___ ________ ___ _________ ___.
____ ________ ___ ____ ______ ____ ______ ____ _________ _________ ____ _________.
_____ _____ _________ ______ ________ _________ ________.
_________ _________ ___ ____ ___ ______.
______ ______ ____ ______ __________ ____.
_____ _______ __________ _____ ___ _______ ___ ___.
__________ ______ ___ _________ _______ __________ ___.
__________ _______ __________ ______ _________ _______ __________ ____.
________ ___ ___ ______ _______ __________ _________ ______ ____ ___ _________.
_______ ____ __________ ____ _______ __________ _________ _______.
__________ _____ ____ __________ _________.
_________ _________ ________ _________ _____ _____ _____ _______.
______ _______ ____ _____ __________ _________.
___ _________ ________ _______ __________ _____ ___ ___ _________.
______ ____ ____ ________ ___ ____.
______ __________ ___ ________ __________ ___ ______ _____ ________.
__________ ___ _______ ______ __________ _____ _____ _________ _____ __________ _______ _________.
______ _____ __________ _____ _______ ______ __________ ______ ________.
______ __________ _______ _________ ______ ________ ________ _________.
___ _________ ______ ________ ______.
________ ________ _________ _____ ___ _________ _________.
________ _________ ___ __________ _______ _______ ___ ________.
_____ _________ _______ ______ ___ __________ __________ __________ _________.
___ _______ ___ ______ ______ _________ _________ ____ ___ ______.
_____ _____ _________ ____ _______ __________.
_________ _______ __________ _____ ____ ________ _________ ______ _________ _____ _________.
_____ _________ ______ __________ _______.
______ _______ _____ __________ ____ _________ ________ ______ ______.
______ _______ __________ ______ ________ ____ _________ _________ __________ _______ _____.
______ _____ __________ __________ ______ __________ ________ ____.
_______ _____ __________ _________ _______ ____ ____ _______.
____ _______ ___ _____ ____ ________ ____.
____ ________ ______ _____ ______ _______ ____.
________ _______ ___ __________ ______ _________ __________.
_______ _______ ____ ___ ______.
_______ _____ _______ _______ _______ _______ ___ _________ _____ ________.
________ __________ _________ _____ _____ _______ ______ ___ ________ _____ ___ ___.
__________ ______ _________ ____ ________ ____ _____ ___ ________.
__________ _____ ____ __________ _________ _________ _______ __________ _________ __________.
_____ _________ ________ ___ ____ ________ __________ _________ _______.
_________ __________ ___ ______ __________ ____ _______ _________ ___ _____ _________.
_________ _____ ______ ________ _____.
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 MCS 24 2022 2023 - What is interface? Explain difference between abstract class and inter | IGNOU Academy
→
🟢
WhatsApp Chat Fast live messaging
→
Email Us Business enquiries & support
→