" async="async"> ', { cookie_domain: 'auto', cookie_flags: 'max-age=0;domain=.tistory.com', cookie_expires: 7 * 24 * 60 * 60 // 7 days, in seconds }); Java Method Signature 자바 메서드 시그니처 :: 일단

자바독을 보다 보면 Signature라는 단어가 자주 나온다. 내가 아는 시그니처는 맥도널드 시그니처, 엘지 시그니처, 유명인사들의 사인? 뿐인데...

 

아주 간단한 것이다. 아래 코드에서 메서드 시그니처는 Multiply(int a, int b) 이다.

public int Multiply(int a, int b) {
	return a * b;
}

 

자바 프로그래밍 언어에서 메서드 시그니처는 메서드 명과 파라미터의 순서, 타입, 개수를 의미한다. 리턴 타입과 exceptions는 메서드 시그니처가 아니다.

 

아래 두 메서드는 다른 시그니처를 가진다.

doSomething(String[] y);
doSomething(String y);

아래 메서드들은 모두 같은 시그니처를 가진다.

int doSomething(int y) 
String doSomething(int x)
int doSomething(int z) throws java.lang.Exception

 

출처 : https://en.wikipedia.org/wiki/Type_signature

+ Recent posts