Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialZeljko Porobija
11,491 PointsException in thread "main" java.util.UnknownFormatConversionExcept ion: Conversion = '%'
When I run my code, I get this:
Exception in thread "main" java.util.UnknownFormatConversionExcept
ion: Conversion = '%'
at java.util.Formatter.checkText(Formatter.java:2579)
at java.util.Formatter.parse(Formatter.java:2565)
at java.util.Formatter.format(Formatter.java:2501)
at java.io.PrintStream.format(PrintStream.java:970)
at java.io.PrintStream.printf(PrintStream.java:871)
at Karaoke.main(Karaoke.java:12)
Here's my code, I really cannot see the problem.
Zeljko Porobija
11,491 Pointspackage com.teamtreehouse.model; //helpers classes
import java.util.ArrayList;
import java.util.List;
public class SongBook {
private List<Song> mSongs;
public SongBook() {
mSongs = new ArrayList<Song>();
}
public void addSong(Song song) {
mSongs.add(song);
}
public int getSongCount() {
return mSongs.size();
}
}
Zeljko Porobija
11,491 Pointspackage com.teamtreehouse.model;
public class Song {
private String mArtist;
private String mTitle;
private String mVideoUrl;
public Song (String artist, String title, String videoUrl) {
mArtist = artist;
mTitle = title;
mVideoUrl = videoUrl;
}
public String getTitle() {
return mTitle;
}
public String getArtist() {
return mArtist;
}
public String getVideoUrl() {
return mVideoUrl;
}
@Override
public String toString() {
return String.format("Song: %s by %s", mTitle, mArtist);
}
}```
2 Answers
miikis
44,957 PointsLine 12 of Karaoke.java has a typo: should be %n not n%.
Zeljko Porobija
11,491 PointsI've just figured it out the moment before you posted the answer. LOL, silly me. :-) Thnx! One Best Answer for you!
Zeljko Porobija
11,491 PointsZeljko Porobija
11,491 Points