About java abstract class

abstract method

What is an abstract method?

--Method whose processing content is undefined --The processing content is described in the inherited class.

Purpose of creating an Abstract method

--Used to specify the description, specifications, and design of the child class --Unified application design makes development easier

Declaration method

void normalMethod(){
	//processing
}
abstract void abstractMethod();

The class containing the Abstract method must be a ╩╗abstract class`

abstract class

--Class containing Abstract method --Used to be the inheritance source

Declaration method

abstract class ClassName{
	//Method etc.
}

Inheritance of abstract class

class ChildClass extends AbstractClass{
	void abstractMethod(){
	  //Processing content
	}
}

Concrete example

Example: A child class that inherits from the following student class will have to have a study method

Description


I want to design the object of "Student class" to have "study method".
However, I don't know the specific content of the study method, so I wrote it abstractly with abstract.

The "Informaics Student class" is a class that inherits the student class.
Describe "I am studying informatics" in the study method.

abstract class


abstract class Student(){
	abstract void study();
}

Child class

class InformaicStudent() extends Student{
	void study(){
		System.out.println("I studied informatics");
	}
}

Recommended Posts

About java abstract class
About Java class
[java] abstract class
About class division (Java)
About Java StringBuilder class
[Java] About Singleton Class
About Java class loader types
Java learning memo (abstract class)
About Java class variables class methods
About abstract classes in java
About Java interface
[Java] About Java 12 features
[Java] Class inheritance
java Scanner class
Java HashMap class
[Java] About arrays
About class inheritance.
Something about java
Where about java
About Java features
Java anonymous class
About Java threads
[Java] About interface
About java inheritance
About interface, java interface
[Java] Object class
Java local class
About List [Java]
About java var
About Java literals
About Java commands
About Java log output
About Java functional interface
Java abstract modifier [Note]
Java, about 2D arrays
About the StringBuilder class
About Java method binding
abstract (abstract class) and interface (interface)
About method splitting (Java)
Java inner class review
[Java Silver] About initialization
About Java Array List
About Java Polymorphism super ()
[Swing] About JFrame class
Java class type field
About inheritance (Java Silver)
About Java lambda expressions
About Java entry points
About Java 10 Docker support
Personal summary about Java
About sorting java.util.Arrays class
Java programming (class structure)
All about Java programming
Why java allows final class A {abstract class B {}}
Interface / abstract class / override
Use of Abstract Class and Interface properly in Java
[Java] Integer wrapper class reference
A note about Java GC
Advanced inheritance abstract, interface -java
Java memo (standard class) substring
About an instance of java