Java learning memo (abstract class)

I'm studying Java Silver, so I'll upload it as my memorandum. Since it is a rough memo, details are not described.

An abstract method is a method that defines only the method that has no implementation (method name, argument type, number of arguments) and the return type.


Notes
(1) Since it cannot be instantiated directly, instantiate a subclass. (2) For the above reason, when calling the superclass constructor, it is necessary to describe the constructor in a subclass and use super (); to call the superclass constructor. ③ Override all abstract methods. (4) The description is as follows, and {} is not described in the abstract method. abstract class class name { abstract Return type name Method name (argument);  } ⑤ Inherit and override with extends.

public abstract class _abstract {
	public void test(int num) {
		System.out.println(1);
		method(num);
		System.out.println(3);
	}
	public abstract void method(int num);
}

public class _subabstract extends _abstract{
	public static void main(String[] str) {
		_subabstract sub = new _subabstract();
		sub.test(2);
	}

	public void method(int num) {
    	System.out.println(num);
	}
}

Override: Define a method with the same method name, number of arguments, and order. Overload: To define a method with the same method name but different number and order of arguments.

Recommended Posts

Java learning memo (abstract class)
java (abstract class)
[java] abstract class
Java learning memo (method)
Java learning memo (basic)
Java learning memo (interface)
Java learning memo (inheritance)
About java abstract class
Java Basic Learning Content 6 (Inheritance / Abstract Class / Interface)
Java memo (standard class) substring
Java learning memo (data type)
Java memo (standard class) length
Java learning memo (logical operator)
Java learning (0)
Java memo
Java learning memo (creating an array)
Java learning memo (while statement, do-while statement)
java anything memo
Java class methods
[Java] Class inheritance
(Learning memo) Java Level 2 measures: Question range
java Scanner class
Java Silver memo
For JAVA learning (2018-03-16-01)
Java learning day 5
java, maven memo
[Java] Nested class
Java SE 7 memo
Java anonymous class
About Java class
JAVA learning history abstract classes and methods
[Java] Object class
Java local class
Java specification memo
java learning day 2
Java pattern memo
java learning day 1
Why java allows final class A {abstract class B {}}
Java abstract modifier [Note]
About class division (Java)
Java learning 2 (learning calculation method)
java learning (conditional expression)
java basic knowledge memo
Java Learning (1)-Hello World
[Java ~ Method ~] Study memo (5)
abstract (abstract class) and interface (interface)
java se 8 programmer Ⅰ memo
Java paid private memo
Learning memo 01 (forward / redirect)
Java inner class review
JAVA learning history interface
Java class type field
Java programming (class method)
[Java ~ Array ~] Study memo 4
java lambda expression memo
About Java String class
(Memo) Java for statement
Java lambda expression [memo]
Java programming (class structure)
[Java] Implicit inheritance memo
java competitive programming memo