Город МОСКОВСКИЙ
00:18:10

java tutorial 29 Abstract classes and abstract methods

Аватар
Кодовый революционер с Python
Просмотры:
24
Дата загрузки:
02.12.2023 12:33
Длительность:
00:18:10
Категория:
Обучение

Описание

Welcome to code terminators : )
????????

playlist ( java tutorial ):-
https://youtube.com/playlist?list=PLGUm-ZA2OkIX_tZe_HJLPka7J0r1lrrmA

Inheritance in java part 1 :-
https://youtu.be/K_2Bqj0vTb0

Inheritance in java part 2:-
https://youtu.be/AQGX_5cfyLY

Inheritance in java part 3:-
https://youtu.be/ULYqJF6t0q8

Abstract class in Java :-

A class which is declared as abstract is known as an abstract class. It can have abstract and non-abstract methods. It needs to be extended and its method implemented. It cannot be instantiated.

Points to Remember
An abstract class must be declared with an abstract keyword.
It can have abstract and non-abstract methods.
It cannot be instantiated.
It can have constructors and static methods also.
It can have final methods which will force the subclass not to change the body of the method.


Abstract Methods in Java :-
Sometimes, we require just method declaration in super-classes. This can be achieve by specifying the abstract type modifier. These methods are sometimes referred to as subclasser responsibility because they have no implementation specified in the super-class. Thus, a subclass must override them to provide method definition. To declare an abstract method, use this general form:


abstract type method-name(parameter-list);
As you can see, no method body is present. Any concrete class(i.e. class without abstract keyword) that extends an abstract class must override all the abstract methods of the class.
Important rules for abstract methods:


Any class that contains one or more abstract methods must also be declared abstract
The following are various illegal combinations of other modifiers for methods with respect to abstract modifier:
final
abstract native
abstract synchronized
abstract static
abstract private


thanks for watching
like and share our video...

Рекомендуемые видео