import java.io.*;
import java.util.ArrayList;
import java.util.Scanner;
class Arralist{
public static <Cd> void main(String [] args) {
ArrayList<Cd> liste = new ArrayList<Cd>();
try {
Scanner input = new Scanner(new File("text.txt"));
while (input.hasNext()) {
liste.add(input.next());
}
input.close();
}
catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}
I got error like this :
: error: no suitable method found for add(String)
liste.add(input.next());
^
method ArrayList.add(int,Cd) is not applicable
(actual and formal argument lists differ in length)
method ArrayList.add(Cd) is not applicable
(actual argument String cannot be converted to Cd by method invocation conversion)
where Cd is a type-variable:
Cd extends Object declared in method <Cd>main(String[])
1 error
Process completed.
What wrong how do I fix this