Skip to content

Commit 53418ca

Browse files
committed
Interface and Abstract Classes 2
1 parent 303bd11 commit 53418ca

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

Interface and Abstract Class/Drivable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**Interfaces are basically compact */
2-
public interface Drivable {
2+
public interface Drivable {
33
double PI = 3.14;
44
double getSpeed();
55
void setSpeed(double speed);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Interface
2+
* Interface is basically a replacement for for extending classes since we can implement as many interfaces as we want in a Class.
3+
* Interface basically has two main components
4+
- Constants (By default)
5+
- Methods (They do not have data type)
6+
* When we implement the **Interface** to a class then we nedd to define all the **methods** of the Interface.
7+
8+
# Abstract
9+
* Abstract is similar to Interface. It is a class itself.
10+
* When we extend an Abstract Class to a Class, we need to define all the **methods** defined in the Abstract Class else the derived class again should be Abstract.

0 commit comments

Comments
 (0)