java
가변인자 선언에 대한 컴파일 처리
improve
2024. 2. 6. 11:54
package org.example;
public class Main3 {
public static void showAll(String...aa){
for (String temp :aa){
System.out.println(temp);
}
}
public static void main(String[] args) {
showAll("box");
System.out.println();
showAll("box","show");
System.out.println();
showAll("box","show","all");
}
}
show 에대한 퍼블릭 함수를 만들어준다
배열을 굳이 만들 필요없이 사용할 수 있다.
box
box
show
box
show
all
이렇게 출력이 된다.