簡體   English   中英

將Jama矩陣寫入文件

[英]Writing jama matrix to file

我想使用jama庫將矩陣寫入java中的文件,但是只生成一個空文件。 我正在使用下面的代碼。 有什么事嗎

PrintWriter writer = null;
    try {
        writer = new PrintWriter("deneme.txt", "UTF-8");
    } catch (FileNotFoundException | UnsupportedEncodingException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    m3.print( writer,2,2);

對於這一行代碼, writer可以為null。 移動m3.print(writer,2,2); 在try塊的內部。

PrintWriter writer = null;
try {
    writer = new PrintWriter("deneme.txt", "UTF-8");
    m3.print(writer, 2, 2);
} catch (FileNotFoundException | UnsupportedEncodingException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM