jndonovan
March 22nd, 2010, 03:06 AM
Hi there I am just trying to learn java and am really stuck on a problem, was just wondering if anyone can help me figure it out. I may not be able to explain what i am trying to do well enough for anyone to understand so don't be too hard on me :)
I have 2 classes and am using an arrayList to add objects from class Track into class PlayList which contains the arrayList. I am trying to use the .equals method of the string class to find an artist by name and print out their details if their name is searched for and found. I have written the following code and get the error message ')' expected but don't understand what that means?
public void String (Track returnName)
{
if (returnName.equals(Track artist))
{
System.out.println(printDetails);
}
else
{
System.out.println("There is no artist with this name");
}
}
I have 2 classes and am using an arrayList to add objects from class Track into class PlayList which contains the arrayList. I am trying to use the .equals method of the string class to find an artist by name and print out their details if their name is searched for and found. I have written the following code and get the error message ')' expected but don't understand what that means?
public void String (Track returnName)
{
if (returnName.equals(Track artist))
{
System.out.println(printDetails);
}
else
{
System.out.println("There is no artist with this name");
}
}