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 Getting There Packages

Nikhil Sharma
Nikhil Sharma
1,173 Points

is that problem with you

i think its true , but whats that error

com/example/BlogPost.java
package com.example;
  public class BlogPost{
    public static void main(String[] args)

  }
Display.java
import com.example.BlogPost;
public class Display {
  public static void main(String args[])
  {
    BlogPost blog = new BlogPost();
    System.out.println("This is a blog post : %s",blog);
  }
    // Your code here...


}

2 Answers

Hey Nikhil,

As mentioned in the prompt, leave the BlogPost class blank. You currently have:

package com.example;
  public class BlogPost{
    public static void main(String[] args)
}

What you want is this:

package com.example;
class BlogPost {}

You also want to use printf and not println:

import com.example.BlogPost;
public class Display {
  public static void main(String[] args) {
    // Your code here...
    BlogPost post = new BlogPost();
    System.out.printf("This is a blog post: %s", post); // Be sure to use printf and not println
  }
}

With that being said, think about why having public static void main(String[] args) in your BlogPost class would cause an error.

Nikhil Sharma
Nikhil Sharma
1,173 Points

yeah got that ! thanks for response