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
ruben contesti
1,279 PointsCannot find symbol error
I'm getting this error
./com/example/BlogPost.java:25: error: cannot find symbol
if(equal(com.example.BlogPost)){
^
symbol: class example
location: package com
1 error
For this code:
package com.example;
import java.util.Date;
public class BlogPost implements Comparable {
private String mAuthor;
private String mTitle;
private String mBody;
private String mCategory;
private Date mCreationDate;
public BlogPost(String author, String title, String body, String category, Date creationDate) {
mAuthor = author;
mTitle = title;
mBody = body;
mCategory = category;
mCreationDate = creationDate;
}
//////////////////////////////////////////////////////////
//
public int compareTo(Object obj){
com.example.BlogPost other =(com.example.BlogPost) obj;
if(equal(com.example.BlogPost)){
return 0;
}
return 1;
}
//
public String[] getWords() {
return mBody.split("\\s+");
}
public String getAuthor() {
return mAuthor;
}
public String getTitle() {
return mTitle;
}
public String getBody() {
return mBody;
}
public String getCategory() {
return mCategory;
}
public Date getCreationDate() {
return mCreationDate;
}
}
2 Answers
Ryan Ruscett
23,309 PointsFor lake of typing out the explanation. I will point you here
This is an Answer in Forum already.
Should have the answer you are looking for. Let me know if not and I can attempt to type it out for ya.
ruben contesti
1,279 PointsOk. I already solved it. The error was what I was comparing. It should be the obj not BlogPost
ruben contesti
1,279 Pointsruben contesti
1,279 PointsHi Ryan , thank you for the link.
I'm still not able to solve it nor understand what's the issue being addressed on the link. I'm 3 days old in JAVA and still trying to digest it.
I don't really get why JAVA it's not being able to find BlogSpot if I'm writing this code inside BlogSpot.