-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMusic.java
More file actions
44 lines (42 loc) · 1.16 KB
/
Music.java
File metadata and controls
44 lines (42 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
class Album{
String name;
String artist;
int year;
public Album(String name, String artist, int year) {
this.name = name;
this.artist = artist;
this.year = year;
}
public String getName(){
return name;
}
public String getArtist(){
return artist;
}
public int getYear(){
return year;
}
}
class Song extends Album{
String title;
String genre;
public Song(String name, String artist, int year, String title, String genre){
super(name, artist, year);
this.title = title;
this.genre = genre;
}
public String getTitle(){
return title;
}
public String getGenre(){
return genre;
}
}
public class Music{
public static void main(String[] args) {
Song single = new Song("X", "Ed Sheeran", 2014, "Photograph", "Pop");
System.out.println("Judul Lagu: "+single.getTitle() + "\nNama Penyanyi: "+single.getArtist());
System.out.println("Nama Album: "+single.getName() + "\nTahun Rilis: "+single.getYear());
System.err.println("Genre: "+single.getGenre());
}
}