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 Class Review

Martez Hall
Martez Hall
878 Points

com/example/BlogPost.java

I cant understand the problem with this code isn't the package statement on the first line but it keeps tell me to, "Make sure you keep the package statement on the first line. There seems to be some problems, use preview to see the compilation errors." When I look it keeps telling me that the creation date variable is the problem but I don't see anything wrong. Helllppppp!!!!

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

import java.util.Date;

public class BlogPost {
  private String mAuthor;
  private String mTitle;
  private String mBody;
  private String mCategory;
  private class Date mCreationDate;
   }
}

3 Answers

George Pirchalaishvili
George Pirchalaishvili
3,747 Points

Well i see couple of problems to be honest:

1) private class Date mCreationDate; - You should remove class since it is a variable

2) you have extra " } " sign

Victor Learned
Victor Learned
6,976 Points

Try removing 'class' from your statement. The compiler things you are trying to declare a new class when really you just want to use a Date object.

private Date mCreationDate;
Craig Dennis
STAFF
Craig Dennis
Treehouse Teacher

Yeah it's a little tricky, I had to include the package statement bit in the compilation warning. But the real problem is the aforementioned syntax errors.

Sorry for the confusion!