KEMBAR78
Interface java | PPTX
Interface
CSE 221: OBJECT ORIENTED PROGRAMMING
ATIA FYROSE
191-15-2351
DEPARTMENT OF CSE
DIU,PC
What is interface ?
An interface is a completely "abstract class" that is used to group related methods
Java uses Interface to implement multiple inheritance. A Java class can implement
multiple Java Interfaces.
In general ,an interface is a device or system that unrelated entities use to interact.
Such as -
A remote control is an interface between me and a television
Key Points on Interface
 Interface cannot be declared as private, protected or transient.
 All the interface methods are by methods are by default abstract and public.
 Variables declared in interface are public , static and final by default
 Interface variables must be initialized at the time of declaration otherwise compiler will throw
an error
 Inside any implementation class , you cannot change the variables declared in interface
Access Modifiers In an Interface
Java Interface Concept
outpu
t
Why And When To Use Interfaces?
1) To achieve security - hide certain details and only show the important details of an
object (interface).
2) Java does not support "multiple inheritance" (a class can only inherit from one
superclass). However, it can be achieved with interfaces, because the class
can implement multiple interfaces.
When To implement multiple interfaces, separate them with a comma.
THANK YOU

Interface java

  • 1.
    Interface CSE 221: OBJECTORIENTED PROGRAMMING ATIA FYROSE 191-15-2351 DEPARTMENT OF CSE DIU,PC
  • 2.
    What is interface? An interface is a completely "abstract class" that is used to group related methods Java uses Interface to implement multiple inheritance. A Java class can implement multiple Java Interfaces. In general ,an interface is a device or system that unrelated entities use to interact. Such as - A remote control is an interface between me and a television
  • 3.
    Key Points onInterface  Interface cannot be declared as private, protected or transient.  All the interface methods are by methods are by default abstract and public.  Variables declared in interface are public , static and final by default  Interface variables must be initialized at the time of declaration otherwise compiler will throw an error  Inside any implementation class , you cannot change the variables declared in interface Access Modifiers In an Interface
  • 4.
  • 5.
    Why And WhenTo Use Interfaces? 1) To achieve security - hide certain details and only show the important details of an object (interface). 2) Java does not support "multiple inheritance" (a class can only inherit from one superclass). However, it can be achieved with interfaces, because the class can implement multiple interfaces. When To implement multiple interfaces, separate them with a comma.
  • 6.