google.com, pub-8786015629279405, DIRECT, f08c47fec0942fa0 Write a Program to Implement Abstract Class in Java

Write a Program to Implement Abstract Class in Java

0
An abstract type is a type in a nominative type system which cannot be instantiated directly. Abstract types are also known as existential types. An abstract type may provide no implementation, or an incomplete implementation. The object oriented form of abstract types are known as abstract base classes or simply abstract classes.

Syntax

abstract class class_name {
 //abstract method_name
}

Abstract Class Example Program

abstract class One { 
 abstract void methodTwo(); 
 void disp() { 
 System.out.println("I am inside a concrete method."); 
 } 
 
}
class Two extends One { 
 void display() { 
 System.out.println("I am inside extended class B."); 
 } 
}

class AbstractClassDemo { 
 public static void main(String args[]) { 
 Two obj = new Two(); 
 obj.display(); 
 obj.disp(); 
 } 
}

Sample Output

Output is:
I am inside extended class B.
I am inside a concrete method.


Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.

Thank you for your interest 😊

We will back shortly after reviewing...

Thank you for your interest 😊

We will back shortly after reviewing...

Post a Comment (0)

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !
To Top