Question: In the code below what is this on line 3 3 : public class Record { private String title; private String artist; private int yearReleased;

In the code below what is "this" on line 33:
public class Record {
private String title;
private String artist;
private int yearReleased;
// Constructor
public Record(String title, String artist, int yearReleased){
this.title = title;
this.artist = artist;
this.yearReleased = yearReleased;
}
// Accessor methods
public String getTitle(){
return title;
}
public String getArtist(){
return artist;
}
public int getYearReleased(){
return yearReleased;
}
// Display method
public void display(){
System.out.println(title +""+ artist +"("+ yearReleased +")");
}
// comesBefore method
public boolean comesBefore(Record record){
int artistComparison = this.artist.compareToIgnoreCase(record.getArtist());
if (artistComparison <0){
return true;
} else if (artistComparison ==0){
return this.yearReleased < record.getYearReleased();
} else {
return false;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!