--Method whose processing content is undefined --The processing content is described in the inherited class.
--Used to specify the description, specifications, and design of the child class --Unified application design makes development easier
void normalMethod(){
	//processing
}
abstract void abstractMethod();
The class containing the Abstract method must be a ʻabstract class`
--Class containing Abstract method --Used to be the inheritance source
Declaration method
abstract class ClassName{
	//Method etc.
}
class ChildClass extends AbstractClass{
	void abstractMethod(){
	  //Processing content
	}
}
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