I'm trying to read a .txt file that contains several lines with the name of a professional carreer in each one of them. I've created a Scanner but whenever I want to add what the scanner have just read and try to add it to the arrayList, this error pops up
The method add(ClassName) in the type ArrayList is not applicable for the arguments (String)
ArrayList<Claseqla> clista = new ArrayList<Claseqla>();
Scanner s = new Scanner(new File("texto.txt"));
while(s.hasNextLine())
{
**clista.add(s.nextLine());**
}
This is the piece of code inside another class;
The bold marked line is where the error pops up.
clista
only has 2 attributes but I'd like to add them to the list with just one String element filled and the other empty (Is that even possible?)