Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Song {
- private String title;
- private String album;
- private String artist;
- private int songLength;
- public Song() {
- title = "";
- album = "";
- artist = "";
- songLength = 0;
- }
- public Song(String t, String al, String ar, int length) {
- title = t;
- album = al;
- artist = ar;
- songLength = length;
- }
- public void setTitle(String t) { title = t; }
- public void setAlbum(String al) { album = al; }
- public void setArtist(String ar) { artist = ar; }
- public void setLength(int length) { songLength = length; }
- public String getTitle() { return title; }
- public String getAlbum() { return album; }
- public String getArtist() { return artist; }
- public int getLength() { return songLength; }
- public boolean equals(Object obj) {
- Song s = (Song) obj;
- if (s != null) {
- return this.getTitle().equals(s.getTitle()) &&
- this.getAlbum().equals(s.getAlbum()) &&
- this.getArtist().equals(s.getArtist()) &&
- this.getLength() == s.getLength();
- }
- return false;
- }
- public String toString() {
- return "title: " + title + ", album: " + album + ", artist: " + artist + ", length: " + songLength;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement