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 Object Inheritance

Jessie Burton
Jessie Burton
5,198 Points

My workspace is not compiling I have done the exact same thing he has done

./com/teamtreehouse/Treet.java:5: error: missing method body, or declare abstract
private String mAuthor();
^
./com/teamtreehouse/Treet.java:6: error: missing method body, or declare abstract
private String mDescription();
^
./com/teamtreehouse/Treet.java:7: error: missing method body, or declare abstract
private Date mCreationDate();
^
./com/teamtreehouse/Treet.java:10: error: cannot find symbol
mAuthor = author;
^
symbol: variable mAuthor
location: class Treet
./com/teamtreehouse/Treet.java:11: error: cannot find symbol
mDiscription = description;
^
symbol: variable mDiscription
location: class Treet
./com/teamtreehouse/Treet.java:12: error: cannot find symbol
mCreationDate = creationDate;

What is this error? and how do I import a snapshot of my workspace to these comments? My Treet.class is empty(I didnt delete anything)

7 Answers

Alex Bratkovskij
Alex Bratkovskij
5,329 Points

Could you please post a code from your workspace? :)

From the errors it says that you didnt declare your method properly.

Hi, Be aware of your method signature For example should be defined as follows private String mAuthor() { //some code... then return a string return ""; }

As per Alex said, ensure adding your code every time you need help, above code is just an example.

Best regards

Mauro

Jessie Burton
Jessie Burton
5,198 Points

I dont know how to import my snap shot into here? AND I cant copy/ paste it here. right click doesnt work in work space code area

Ok just copy the entire class code here (Treet.java) or in a comment.

Jessie Burton
Jessie Burton
5,198 Points

package com.teamtreehouse;

public class Treet { private String mAuthor(); private String mDescription(); private Date mCreationDate();

public Treet(String author, String description, Date creationDate) { mAuthor = author; mDescription = creationDate; }

public String getAuthor() { return mAuthor; }

public String getDescription() { return mDescription; } public Date getDate() { return mCreationDate; } }

Hi

Just remove parentheses in this line: private String mAuthor(); so it should look like this:

private String mAuthor;

Now give another try

Best regards

Jessie Burton
Jessie Burton
5,198 Points

Where do I put in my return mAuthor variable?

This is the error I get when I follow your directions:

./com/teamtreehouse/Treet.java:14: error: ';' expected
public String getAuthor {
^
./com/teamtreehouse/Treet.java:17: error: ';' expected
public String getDescription {
^
./com/teamtreehouse/Treet.java:20: error: ';' expected
public Date getDate {

Hi,

Remember that when you are declaring variables you don't use '()' at the end:

private String mAuthor();

private String mDescription();

private Date mCreationDate();

Just

private String mAuthor;

private String mDescription;

private Date mCreationDate;

and also add the "imports" for each class above your class declaration and below the package declaration

package com.teamtreehouse;

import java.util.Date;

public class Treet {

...

Lastly at the constructor there is one last thing:

public Treet(String author, String description, Date creationDate) {
    mAuthor = author;
// Remember that when assigning values to a variable with another the type must match ... 
// Line below in your code has to be fixed, try follow variable names as hint.
    mDescription = creationDate; 
}