Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@rmswimkktt
Created May 7, 2013 13:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmswimkktt/5532567 to your computer and use it in GitHub Desktop.
Save rmswimkktt/5532567 to your computer and use it in GitHub Desktop.
メソッドに複数の引数を渡す方法で、知らない書き方(multiArgument1)があった…。
public class MultiArgument {
public static void main(String[] args) {
MultiArgument.multiArgument1("Apple", "Orage", "Grape");
String[] strings = {"Apple", "Orage", "Grape"};
MultiArgument.multiArgument2(strings);
}
public static void multiArgument1(String... strings){
for(String string : strings){
System.out.println(string);
}
}
public static void multiArgument2(String[] strings){
for(String string : strings){
System.out.println(string);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment