I currently have no clue how to put the super() in the if statement. I tryed it, but it wont compile and intellej id tell me super hast to be the first statement in the constructor...
package de.codegym.task.task18.task1814;
import java.io.FileInputStream;
import java.io.IOException;
/*
UnsupportedFileName
*/
public class TxtInputStream extends FileInputStream {
private String filename;
public TxtInputStream(String fileName) throws UnsupportedFileNameException,IOException {
super(fileName);
int i = fileName.length();
this.filename = fileName;
if(i<3)i=3;
if(fileName.substring(i-3).equals("txt")){
}
else
{super.close();throw new UnsupportedFileNameException();
}
}
public static void main(String[] args) throws Exception {
new TxtInputStream("C:\\Users\\Felix\\Desktop\\Beste Hand 100 000 Mal bis 8.txt");
}
}