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 trial

Alexandra Bonono
9,817 PointsI get "Exception in thread "main" java.util.UnknownFormatConversionException:" after compiling the code
Please I need some help with my code. I believe I have the same code as the instructor by the end of the video, however, when I compile I get the following error message:
Adding Exception in thread "main" java.util.UnknownFormatConversionException: 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.util.Formatter.format(Formatter.java:2455)
at java.lang.String.format(String.java:2940)
at com.teamtreehouse.model.Song.toString(Song.java:28)
at java.util.Formatter$FormatSpecifier.printString(Formatter.java:2886)
at java.util.Formatter$FormatSpecifier.print(Formatter.java:2763)
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.util.Formatter.format(Formatter.java:2455)
at java.lang.String.format(String.java:2940)
at com.teamtreehouse.model.Song.toString(Song.java:28)
at java.util.Formatter$FormatSpecifier.printString(Formatter.java:2886)
at java.util.Formatter$FormatSpecifier.print(Formatter.java:2763)
at java.util.Formatter.format(Formatter.java:2520)
at java.io.PrintStream.format(PrintStream.java:970)
at java.io.PrintStream.printf(PrintStream.java:871)
at Karaoke.main(Karaoke.java:13)
Song.java
package 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 getArtist(){ return mArtist; }
public String getTitle(){ return mTitle; }
public String getVideoUrl(){ return mVideoUrl; }
@Override public String toString(){ return String.format("Song: %s by s%.", mTitle, mArtist); }
}
SongBook.java
package com.teamtreehouse.model;
import java.util.List; import java.util.ArrayList;
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(); }
}
Karaoke.java
import com.teamtreehouse.model.Song; import com.teamtreehouse.model.SongBook;
public class Karaoke{
public static void main(String[] args){ Song song = new Song( "Michael Jackson", "Beat It", "https://www.youtube.com/watch?v=oRdxUFDoQe0");
SongBook songBook = new SongBook();
System.out.printf("Adding %s %n", song);
songBook.addSong(song);
System.out.printf("There are %d songs. %n", songBook.getSongCount());
}
}
2 Answers

Alexandra Bonono
9,817 PointsThank you Seth!! I did not see that and it wa so obvious.

Seth Kroger
56,416 PointsIt's a simple typo Song.java: return String.format("Song: %s by s%.", mTitle, mArtist); The second %s is backwards.