0% found this document useful (0 votes)
4 views1 page

Part 16

Uploaded by

Up ka sher king
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Part 16

Uploaded by

Up ka sher king
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Java abstract Keyword

The abstract keyword is used to achieve abstrac on in Java. It is a non-access modifier which is used
to create abstract class and method.

The role of an abstract class is to contain abstract methods. However, it may also contain non-
abstract methods. The method which is declared with abstract keyword and doesn't have any
implementa on is known as an abstract method.

Syntax:-

1. abstract class Employee

2. {

3. abstract void work();

4. }

Note - We cannot declare abstract methods in non abstract class.

Rules of abstract keyword

Don'ts

o An abstract keyword cannot be used with variables and constructors.

o If a class is abstract, it cannot be instan ated.

o If a method is abstract, it doesn't contain the body.

o We cannot use the abstract keyword with the final.

o We cannot declare abstract methods as private.

o We cannot declare abstract methods as sta c.

o An abstract method can't be synchronized.

You might also like