Define an abstract class |
Name Java class that implements interface Comparable
|
Abstract
class
An abstract class in java is one which is usually used as a
parent class.
We cannot instantiate an abstract class (We cannot create object of
that class).
An abstract class may or may not have abstract method. An abstract
method is one which is declared in abstract parent class and
implemented in child classes (classes which extend abstract
class).
We can extend abstract class by creating child classes & can
access its attributes & behaviors using child classes.
Example:
Below is a java program which represents an abstract class and a
child class.
Name Java class that implements interface Comparable
// Name class which implements Comparable interface
public class Name implements Comparable{
@Override
public int compareTo(Object o) {
return 0;
}
}
----------------------------------------------------------------------
COMMENT DOWN FOR ANY QUERIES!!!
HIT A THUMBS UP IF YOU DO LIKE IT!!!
Get Answers For Free
Most questions answered within 1 hours.