0
At the moment of instantiating an object I need to go through parâmetro
a directory with a file . txt and read the same. It would be something like this: Texto t1 = new Texto("c:\\pasta\\arquivo1.txt");
However, I don’t know how to do this construtor
and at the same time read the file.
What I have in the main program:
public static void main(String[] args) {
try {
List<Texto> v = new ArrayList<Texto>();
v.add(new Texto(args[0]));
v.add(new Texto(args[1]));
v.add(new Texto(args[2]));
System.out.println(v);
}
catch ( ArrayIndexOutOfBoundsException e) {
System.err.println("Informe tres arquivos para comparacao.");
}
}