티스토리 뷰
반응형
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
TL;DR
- 메소드 시그니쳐: 메소드명 + 매개변수 타입들
Definition:
Two of the components of a method declaration comprise the method signature
- the method's name and the parameter types.
// 메소드 시그니쳐는 메소드를 선언하는 구성 요소 중 두 가지로 이루어진다. - 메소드명, 매개변수 타입들
e.g.
- 어떤 클래스 안에 다음과 같은 메소드를 작성했다고 하자.
public double calculateAnswer(double wingSpan, int numberOfEngines, double length, double grossTons) {
//do the calculation here
}
- 이 경우, 메소드 시그니쳐는 '메소드명'과 '매개변수의 타입'으로 구성되므로 다음과 같다.
calculateAnswer(double, int, double, double)
- 많은 글들이 메소드명과 매개변수 리스트의 조합을 메소드 시그니쳐로 소개한다. 공식 문서에는 parameter types로 나와 있으나, 매개변수 리스트와 매개변수 타입들을 너무 엄격하게 따져 알아둘 필요는 없을 듯 하다.
'Dev. > java' 카테고리의 다른 글
[Java] 공변 반환 타입(covariant return type) (0) | 2022.02.28 |
---|---|
[JVM] 메모리 구조(짧) (0) | 2022.01.19 |
[Spring Cloud] Discovery First Bootstrap Hands-on (0) | 2021.07.21 |
[Spring Cloud] Spring Cloud Config Server, Client 설정하기 (3) | 2021.07.21 |
[Spring Boot] 애플리케이션 실행 직후 Process finished with exit code 0 (0) | 2021.07.21 |
댓글
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- Java
- RancherDesktop
- Spring Cloud Config
- jQuery
- mysql
- Database
- terraform
- AWS
- AWS IoT
- hashicorp
- kotlin
- pgloader
- Node.js
- 코딩테스트
- react
- eureka
- Linux
- javascript
- Git
- IntelliJ
- postgresql
- JPA
- spring boot
- etc
- Gradle
- shell
- Vault
- Puppeteer
- JEST
- Docker
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함