Abstract is a keyword in java. So its a reserved word in java. general meaning of abstract is to hide the implementation, only show the outer structure. Now in computer science its meaning is that user can have their own implementation with abstract method.

Where we can use abstract keyword ?
Abstract can be used with class and method.

By using abstract with the method a user can able to have their own implementation according to their wish. Its the facility given by the java vendor to the user to have their own implementation.

Abstract with class

Using abstract modifier before the class name can make a class as abstract. Making a class as abstract means we cannot instantiate that class.

Syntax :

abstract  < access_modifier > class < class_name > {  } 

< access_modifier > --> Only public is used with abstract . Private and protected are not used.

To know more about abstract class Click here !

Abstract with method

Declaring abstract modifier with the method name will make that method as abstract. An abstract method cannot have their implementation where it is declared, it must be override in its sub-classes.

Syntax :

abstract  < access_modifier > < return_type > < method_name > {  } 

< access_modifier > --> Only public and protected are used. Private cannot be used with it.


Related Posts:

  • ' this ' keyword in Java this is one of the most important keyword in java which refers to the current class object. Like we are creating an object for our class similarly internally a object is there called as this which points to the current class… Read More
  • Inheritance in Java It is a concept in java which provide the re usability of the members of one class/object to another class/object. Inheritance term itself defines the property inheriting. In java we are working with class so here we are goi… Read More
  • Constructor in Java Constructor is the member of the class and it has name same as class name. Constructor is the one of the important concept in java which is responsible to initialize the instance member of the class. Its functionality is lik… Read More
  • Type of inheritance in Java According to OOPS ( Object-oriented concept ) inheritance are classified into 6 category in which java support 5 of them and one is not supported in java i.e multiple inheritance for which there is a concept of interface . I… Read More
  • super keyword in Java Like this in java one more most important keyword is there i.e super. super in Java has a wide use and it is mainly used to call the super class constructor explicitly by the user and implicitly used by the JVM to initialize… Read More

0 comments:

Post a Comment

Ads 468x60px

.

Ads

.

Featured Posts

Popular Posts

Like Us On FaceBook

Total Pageviews

201976

Online Members

Live Traffic