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 trialTim McKyer
10,989 PointsHelp
Getting really frustrated not sure what the problem is please give me some help here and do not just give me the answer I want to understand what the heck I am doing wrong lol
package com.example;
public class BlogPost {
}
import com.example.BlogPost;
public class Display {
public static void main(String[] args) {
// Your code here...
BlogPost blogpost = new BlogPost();
System.out.printf("This is a blog post: %s", BlogPost);
}
}
1 Answer
Kristian Terziev
28,449 PointsYou're using a wrong variable when calling the printf method. You use the class name instead of the variable name. Make sure you go back and review classes if needed. Craig does amazing job explaining them. I've also did some explanation myself here: https://teamtreehouse.com/forum/unfortunately-the-app-has-stopped-working-2
Tim McKyer
10,989 PointsTim McKyer
10,989 PointsSo it should be System.out.printf("This is a blog post: %s", display); ???
Tim McKyer
10,989 PointsTim McKyer
10,989 PointsI think that is right but I think that the problem is where I tried to instantiate a new BlogPost
Kristian Terziev
28,449 PointsKristian Terziev
28,449 PointsNot really. It should be:
I STRONGLY recommend you open the link I provided and also go back in videos. It seems you have quite the issue with classes. They are the core of java so you MUST clear that problem.
Tim McKyer
10,989 PointsTim McKyer
10,989 PointsWill do thank you for the guidance