Notice
Recent Posts
Recent Comments
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Archives
Today
Total
관리 메뉴

DeFacto-Standard IT

[JAVA] Method Signature, Method Type, Method Reference 본문

Java/References

[JAVA] Method Signature, Method Type, Method Reference

defacto standard 2018. 5. 1. 17:08

Method Signature

1. 메서드의 이름

2. 메서드의 파라미터 타입



Method Type

1. 메서드의 리턴 타입

2. 메서드 타입 파라미터

3. 메서드 인자 타입

4. Exception



Method Signature가 같다고 Method Reference를 쓸 수 있는게 아니라,

Method Type이 같아야 Method Reference를 쓸 수 있다.


이는 상속관계에서, 부모클래스의 메서드가 있을 때, 자식클래스의 메서드에서 오버라이딩을 할 수 있는 조건에 해당한다.


따라서 Super super = new Sub(); super.a()와 같은 Method Reference가 가능해진다.

Comments