Which keyword is use in java to indicate use of inheritance

Question

1) Which keyword is used in java to indicate use of inheritance (Sub and super classes)
2) Write about an abstract class.

Explanation

1) Keyword is used in java to indicate the use of inheritance is extends. In java, if you want to access the property of one class into another. So at that time, you use inheritance. So to take the property of one class we will put a keyword extend.

we have the syntax of class inheritance.

class subclass_name extends superclass_name
{ //body of class
}

 

2) Abstract is known by a keyword abstract. To make a class abstract we will put an abstract keyword in front of the class name. Also, there are methods that are abstract. An abstract class should have at least one abstract method. Also, an abstract class can be inherited.

 

Also read, You are to implement an efficient positional collection of elements to share a resource.

Share this post

Leave a Reply

Your email address will not be published. Required fields are marked *