슈퍼 문을 올바른 형식으로 넣었습니다. 그러나 유일한 오류는 클래스 java.lang.object의 생성자 객체가 코드의이 부분에 대해 지정된 유형에 적용될 수 없다는 것입니다.내 슈퍼 문을 어떻게 수정합니까?
super (openFile (filename));
여기 지금 내 현재 코드입니다 :
이 import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Vector;import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
public class Buffin
{
private static boolean temp;
/////////////////////////////////
private boolean isKeyboard;
/** Connect to the disk file with the given name. If this
* cannot be done, connect to the keyboard instead. */
public Buffin (String filename)
{ super (openFile (filename));
isKeyboard = temp;
} //======================
private static Reader openFile (String filename)
{ try
{ temp = false;
return new FileReader (filename); // IOException here
}catch (IOException e)
{ temp = true;
return new InputStreamReader (System.in);
}
} //======================
/** Read one line from the file and return it.
* Return null if at the end of the file. */
public String readLine()
{ if (isKeyboard)
{ System.out.print (" input> ");
System.out.flush(); // flush the output buffer
}
try
{ return super.readLine(); // in BufferedReader
}catch (IOException e)
{ System.out.println ("Cannot read from the file");
return null;
}
} //============
}[/code]
'Reader'를 받아들이는'Object' 생성자가 없습니다. –
컴파일러에서 알려주는 지침을 따르십시오! 'Reader'는'(Object)'를 가진 생성자가 없기 때문에 – Rugal