[JAVA] Abstract method

What are the advantages of the abstract class?

An abstract class is a class that has one or more abstract methods. First of all, what is an abstract method? I will explain.

An abstract method is a method that does not have an implementation and defines only the signature (method name, argument type, number of arguments) and return type.

Specifically, it is as follows. Notice where there is abstract at the beginning and there is no {} after the argument parentheses.

abstract Return type number Method name (argument);

Next, write the abstract class as follows.

abstract class class name{
abstract Return type name Method name(argument)
}

The advantage of having a method in an abstract class is that you can force the developer to override the method.

It is necessary to override the abstract method and describe the processing content for each subclass that inherits the abstract class.

However, the processing content can be separated for each subclass. The processing content is different for each subclass, However, if you have to describe the processing contents, you will take advantage of having an abstract class method.

Recommended Posts

Abstract method
Method
Java method
to_i method
java (method)
getRequestDispatcher () method
merge method
Map method
include method
initialize method
List method
puts method
Java method
Class method
save! method
getParameter method
[Java] method
private method
rails method
[Java] method
abstract Factory Pattern
Ruby to_s method
Screen transition method
Binary search binary search method
Method to search
Factory Method Pattern
Exception switching method
RxSwift method chain
Rails delegate method
scan method problem
Java8 method reference
[Ruby] slice method
interface and abstract
[Ruby] end_with? method
[Ruby] Method memorandum
Abstract Factory pattern
[HTTP method PATCH]
About the method
[Java] forEach method
[Practice] Map method
[Servlet] Basic method
variable and method
Binary search method
Template Method pattern
Template Method Pattern
0-filled (non-zero) method
JavaSilver11 study method
keycloak test-skip method
Factory Method pattern
[Ruby] initialize method
Ruby build method
undefined method `** _ path'error
[java] abstract class
java8 method reference
[Java] Random method
Ruby accessor method
[Java] split method
ruby map method