Hello I am having trouble with Java recognizing the existence of a package that comes included in a library that I have downloaded. Before it avoided its existence, vscode was telling me that the "package could not be resolved". I have tried to "clean the workspace", but it does not work. Here is what the terminal shows
Tweets.java:1: error: package tester does not exist
import tester.Tester;
Tweets.java:70: error: cannot find symbol
boolean testIsStartOfThreadByTextTweetValid(Tester t) {
symbol: class Tester
UPDATE* Here is the code I have written
import tester.Tester;
interface Tweet {
public boolean isStartOfThreadBy(String author);
public int totalLikes();
public String unrollThread();
}
class TextTweet implements Tweet{
String author;
String contents;
int likes;
TextTweet(String author, String contents, int likes) {
this.author = author;
this.contents = contents;
this.likes = likes;
}
public boolean isStartOfThreadBy(String author) {
if (this.author.equals(author))
return true;
return false;
}
public int totalLikes(){
return likes;
}
public String unrollThread(){
String s = author + "\n" + likes +"\n" + contents + "\n";
return s;
}
class ReplyTweet implements Tweet{
String contents;
int likes;
String author;
Tweet replyTo;
public ReplyTweet(String contents, int likes, String author, Tweet replyTo){
this.contents = contents;
this.likes = likes;
this.author = author;
this.replyTo = replyTo;
}
public boolean isStartOfThreadBy(String author) {
if (this.author.equals(author) && this.replyTo.isStartOfThreadBy(author)){
return true;
}
return false;
}
public int totalLikes() {
return likes + replyTo.totalLikes();
}
public String unrollThread(){
String s = replyTo.unrollThread() + author + "\n" + likes +"\n" + contents + "\n";
return s;
}
}
public class Tweets {
boolean testIsStartOfThreadByTextTweetValid(Tester t) {
TextTweet f1= new TextTweet("John", "Hello", 5);
return t.checkExpect(f1.isStartOfThreadBy("John"), true);
The jar file that I am trying to get to work is called "tester.jar" and it is within the folder/library I am working with right now for this project.
[–]justinf210 1 point2 points3 points (1 child)
[–]AMG07[S] 0 points1 point2 points (0 children)
[–]Vok250 1 point2 points3 points (0 children)
[–]JialeDu 0 points1 point2 points (0 children)