728x90
반응형
[Error Note] 5. The method -(String) in the type -(Function) is not applicable for the arguments
String(문자열) 형태의 변수를 입력하면, 인삿말을 출력해주는 함수 sayHello.
sayHello에 값을 입력하던 중 에러가 발생했다.
에러가 발생한 지점은 sayHello 함수를 호출하던 부분이다.
The method -(String) in the type -(Function) is not applicable for the arguments
해당 에러는 메서드를 호출 할 때, 변수를 잘못 입력했다는 뜻이다.
값을 대입할 때, 잘못된 자료형으로 대입하면 마주칠 수 있는 에러이다.
문제가 된 함수 sayHello를 살펴보자.
--------
함수 sayHello를 살펴보면,
String 형의 변수(인삿말)를 입력하면 웃는 이모티콘 ^^와 함께 출력해주는 함수라는 걸 알 수 있다.
String형 변수를 받아야 하는데, 변수에 정수형 변수 10을 입력했기 때문에 에러가 난 것이다.
String형 변수인 "안녕, 반가워!"만 남기니 에러가 해결된 것을 알 수 있다.
728x90
반응형
'Error Note' 카테고리의 다른 글
[Error Note] 7. The constructor - is undefiend (0) | 2024.04.18 |
---|---|
[Error Note] 6. Type mismatch: cannot convert (0) | 2024.04.17 |
[Error Note] 4. This method must return a result of type int (0) | 2024.04.15 |
[Error Note] 3. Duplicate local variable result (0) | 2024.04.13 |
[Error Note] 2. The final local variable MAX_NUM cannot be assigned. (0) | 2024.04.10 |