Skip to content

Instantly share code, notes, and snippets.

@shikajiro
Created July 18, 2013 14:52
Show Gist options
  • Save shikajiro/6029983 to your computer and use it in GitHub Desktop.
Save shikajiro/6029983 to your computer and use it in GitHub Desktop.
"長男", "次男", "三男"の3つの文字を代入する文字列型の配列を作ってください。 for文を使って、"僕は◯◯です" と3回表示させてください。 ◯◯には長男次男三男のいずれかが表示されるようにしてください。*
public class HomeWork {
public static void main(String[] args) {
String[] names = new String[] { "長男", "次男", "三男" };
for (String name : names) {
System.out.println("僕は" + name + "です");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment