Hey. I'm struggeling hard. Been trying for 5 hours straight without much progress. I just can't see what'ss wrong. This is my third week learning Java in school. I am looking for guidence. Don't want anyone directly solving the task for me. As that would be cheating, I would fail my whole semester if I got caught.

My current task is to make the audioplayer show the name and time of the selected track. The only class I'm allowed to edit is the Player class. The methods are made, but a lot are missing something to return.
I'm guessing these methods are key to the solution of my first task:

public String getTrackName(){
   return null;

 * Return information about the currently selected track. The information
 * contains the track name and playing time, in the format
 *    track-name (playing time)
 * Return an empty string if no track is selected.
public String getTrackInfo(){
return null;

In class Track, theres a method looking like this:

* Return the name of this track.

public String getName()
    return name;

^ This method is premaid and function as written. So I made a variable to be able to call it from class Track, "public Track trackName;". This is where I got stuck. I get an error while compiling, says I need to change type or operator. The method should return a string. So that should work, right?

public String getTrackInfo(String name){
    if (chosenTrack != null) {
    else {
        return name = null;

    return name;

Link to project files, unedited and progressed version (will update the progressed .zip file once progressed):

Excuse my english if I write like 13 year old, not my main language.

1 Year
Discussion Span
Last Post by Taywin

A couple of hints to get you started:

You changed the signature of the method by adding a parameter. That's not what is required.

You declared a variable for the track name. A name is usually a String, not a Track object


Another hint.

1) You need to modify the getTrackInfo() method. Please read the requirement of what value the method should return. Of course, it must not be null.
2) The requirement states the format of return value. Currently, you have only the name of the track if selected. you still need the play time which may be from another method.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.