이름으로 인사하기
사용자들이 앱에서 이름으로 인사받고 싶다는 피드백을 주었어요. 우리 커스텀 메서드에 그 기능을 추가해 봅시다.
이 연습은 강의의 일부입니다
중급 Java
연습 안내
specificGreeter()의name인자에 올바른 타입을 지정하세요.- 개인화할 수 있도록 문자열 안에서 이 인자를 사용하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
class Greeter {
// Give the correct type to the argument of the method
static void specificGreeter(____ name) {
// Call the correct variable given as an argument to the method
System.out.println("Nice day to you, " + ____ + "!");
}
public static void main(String[] args) {
String firstName = "Caleb";
specificGreeter(firstName);
}
}