Every time I compile this program, it always says there's an error, and I feel like I've done everything right. Currently it's saying that "sentence.add(str1);" has an error because it can't find a symbol? And also the project says that this program should be using the String Class but it wants us to list the words in an Arraylist. When I used the String Class first, it couldn't compile because I wasn't using an Arraylist Class even though I used an Arraylist. So how can we even use it in a String Class if there's an Arraylist? HELP, please.
Here is the code:
class Arraylist{
public static void main(String [] args){
Arraylist sentence = new Arraylist();
String str1 = "Finally";
String str2 = "the";
String str3 = "weather";
String str4 = "is";
String str5 = "warm!";
sentence.add(str1);
sentence.add(str2);
sentence.add(str3);
sentence.add(str4);
sentence.add(str5);
System.out.println(sentence);
}
}