package java0828_class; /* * show()ë©ìë를 ìëì ê°ì´ ì¶ë ¥ì´ ëëë¡ êµ¬ííì¸ì. * * [ì¤í ê²°ê³¼] * ë ¸ë ì 목: Dancing Queen * ê°ì : ABBA * ì¨ë² : Arrival * ìê³¡ê° : Benny Andersson, Bjorn Ulvaeus * ë ë : 1977 * í¸ë ë²í¸ : 2 */ class Song { String title; String artist; String album; String[] composer; int year; int track; public Song() { } public Song(String title, String artist, String album, String[] composer, int year, int track) { super(); this.title = title; this.artist = artist; this.album = album; this.composer = composer; this.year = year; this.track = track; } public void show() { System.out.println("ë ¸ë ì 목 : " + title); System.out.println("ê°ì : " + artist); System.out.println("ì¨ë² : " + album); System.out.print("ìê³¡ê° : "); for (int i = 0; i < composer.length; i++) { /* * System.out.printf("%s", composer[i]); * * if (i < composer.length - 1) { System.out.print(", "); } else { * System.out.println(); } */ String chk = i < composer.length - 1 ? ", " : "\n"; System.out.printf("%s%s", composer[i], chk); } System.out.println("ë ë : " + year); System.out.println("í¸ë ë²í¸ : " + track); } } public class Java073_class { public static void main(String[] args) { Song s = new Song("Dancing Queen", "ABBA", "Arrival", new String[] { "Benny Andersson", "Bjorn Ulvaeus" }, 1977, 2); s.show(); } }