diff options
Diffstat (limited to 'Song.java')
-rw-r--r-- | Song.java | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -1,5 +1,8 @@ public class Song extends MusicalElement{ + + private static final long serialVersionUID = 2112880640160601826L; private String artist, genre; + public Song(String title, int duration, String content, String artist, Genre genre) { super(title, duration, content); this.artist=artist; @@ -12,14 +15,16 @@ public class Song extends MusicalElement{ public void setGenre(Genre genre){this.genre=genre.name();} public String toString() { - return getTitle()+";"+getDuration()+";"+getContent()+";"+artist+";"+genre; + return "Title : "+getTitle()+"\nDuration : "+getDuration()+"\nContent : "+getContent()+"\nArtist : "+getArtist()+"\nGenre : "+getGenre(); +// return getTitle()+";"+getDuration()+";"+getContent()+";"+getArtist()+";"+getGenre(); } - public void save(){ +/* public static void save(){ + String filename="songs.csv"; try { //Saving of object in a file - FileOutputStream file = new FileOutputStream(songs.csv); + FileOutputStream file = new FileOutputStream(filename); ObjectOutputStream out = new ObjectOutputStream(file); // Method for serialization of object @@ -36,7 +41,7 @@ public class Song extends MusicalElement{ { System.out.println("IOException is caught"); } - } + }*/ } |