2017-09-29 7 views
-2
File file = new File("output.txt"); 

PrintWriter output = new PrintWriter(file,true); 

私はPrintWriter(file,true)を使用する場合、それは私がのPrintWriter(ファイル、ブール値)が見つかりませ適しコンストラクタ

エラー表示します "のPrintWriter(ファイル、ブール値)が見つかりませ適したコンストラクタを"

にどのようにそれを解決するために、ありがとう

+1

AS-ブールparameter.and書き込みコードを削除する必要がありますか?物事を作って、それがなぜ存在しないのか不思議ではありません。 – EJP

+0

@Tom可能な重複方法? – EJP

+0

@EJP OP _clearly_は、既存のソースに追加する 'PrintWriter'をインスタンス化し、そこにある回答がその方法を教えてくれます。 – Tom

答えて

1

PrintWriterクラスは受け入れるコンストラクタを持っていませんFile, Boolean

Booleanを削除し、Fileを渡すだけです。

は完全なリストは、一緒に2パラメータファイルとブール値を取る任意のコンストラクタを持っていないOracle

PrintWriter(File file) 
Creates a new PrintWriter, without automatic line flushing, with the specified file. 

PrintWriter(File file, String csn) 
Creates a new PrintWriter, without automatic line flushing, with the specified file and charset. 

PrintWriter(OutputStream out) 
Creates a new PrintWriter, without automatic line flushing, from an existing OutputStream. 

PrintWriter(OutputStream out, boolean autoFlush) 
Creates a new PrintWriter from an existing OutputStream. 

PrintWriter(String fileName) 
Creates a new PrintWriter, without automatic line flushing, with the specified file name. 

PrintWriter(String fileName, String csn) 
Creates a new PrintWriter, without automatic line flushing, with the specified file name and charset. 

PrintWriter(Writer out) 
Creates a new PrintWriter, without automatic line flushing. 

PrintWriter(Writer out, boolean autoFlush) 
Creates a new PrintWriter. 
0

のPrintWriterクラスから取ら参照してください。

だから、あなたはJavadocを相談して考えがあり

File file = new File("output.txt"); 

PrintWriter output = new PrintWriter(file); 
関連する問題