Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Java Java Data Structures Getting There Packages

Aaron Folborg
PLUS
Aaron Folborg
Courses Plus Student 501 Points

It says file does not contain class com.example.BlogPost. For task 4. But I had no errors during task 3

It's having trouble with the package. It's not finding the files that hold the .java file. It shows an error on the import but it worked for task 3 but on task 4 its saying not found.

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

public class BlogPost
{

}
Display.java
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

Mohammad Laif
PLUS
Mohammad Laif
Courses Plus Student 22,295 Points

remove the public keyword before package keyword

public package com.example;

public class BlogPost
{

}

it happens to me too ?