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

Java Java Data Structures - Retired Getting There Packages

Tojo Alex
PLUS
Tojo Alex
Courses Plus Student 13,331 Points

Task 4 of 4

Where did I go wrong?

com/example/BlogPost.java
package com.example;

public class BlogPost {
}  
public class BlogPost{
}
Display.java
import com.example.BlogPost;

public class Display {
  public static void main(String[] args) {
  BlogPost blogPost = new BlogPost();
  System.out.printf("This is a blog post: %s", blogPost);

  }
}

2 Answers

Cam Richardson
seal-mask
MOD
.a{fill-rule:evenodd;}techdegree
Cam Richardson
Front End Web Development Treehouse Moderator 16,895 Points

It may be because you're defining the BlogPost class twice. The java compiler really doesn't like it when you define a class more than once:

./com/example/BlogPost.java:5: error: duplicate class: com.example.BlogPost
public class BlogPost {
       ^
1 error

So you just need to take out the second class definition for BlogPost in com/example/BlogPost.java. Hope that helps!