Method Signature
method name(메서드의 이름)
parameter types( 매개변수의 유형(매개변수의 개수와 타입) )으로 구성됩니다.
Overriding은 Signature가 같은 메서드 사이에서만 발생합니다.
또한 Signature가 같은 메서드는 두 개 이상 정의될 수 없습니다.
return type은 Method Signature에 포함되지 않습니다.
만약 return type이 Signature에 포함된다면 아래 코드는 오류가 발생하지 않을 것입니다.
Method Type
return type (반환 타입)
method type parameter (메서드 타입 파라미터 (제네릭 메서드의 경우) )
parameter types (매개변수들의 타입)
exception (예외) 으로 구성됩니다.
Method Type이 일치해야만 Method Reference에서 사용할 수 있습니다.
Reference
Method Signature
https://docs.oracle.com/javase/tutorial/java/javaOO/methods.html
Defining Methods (The Java™ Tutorials > Learning the Java Language > Classes and Objects)
The Java Tutorials have been written for JDK 8. Examples and practices described in this page don't take advantage of improvements introduced in later releases and might use technology no longer available. See Java Language Changes for a summary of updated
docs.oracle.com
Method Type
https://docs.oracle.com/javase/8/docs/api/java/lang/invoke/MethodType.html
MethodType (Java Platform SE 8 )
A method type represents the arguments and return type accepted and returned by a method handle, or the arguments and return type passed and expected by a method handle caller. Method types must be properly matched between a method handle and all its calle
docs.oracle.com
https://www.youtube.com/watch?v=s-tXAHub6vg
'☕️ Java > 기본' 카테고리의 다른 글
[Java] Method Dispatch란? (Static, Dynamic) (0) | 2022.07.08 |
---|---|
[Java] 리플렉션을 활용한 백준 자동 README 생성기 (0) | 2022.02.07 |
[Java] String Constant Pool (0) | 2022.01.28 |
[Java] String = "" 과 new String("")의 차이 (0) | 2022.01.28 |
[Java] final 키워드 (상수와 리터럴) (0) | 2022.01.28 |