我不知道Go的語法。任何人都可以幫助我在谷歌的go語言中轉換下面的java代碼。從Java到代碼轉換
import java.io.*;
class FileWrite
{
public static void main(String args[])
{
try {
// Create file
FileWriter fstream = new FileWriter("out.txt");
BufferedWriter out = new BufferedWriter(fstream);
out.write("Hello Java");
// Close the output stream
out.close();
} catch (Exception e){ //Catch exception if any
System.err.println("Error: " + e.getMessage());
}
}
}
該java代碼創建一個名爲out.txt的文件,並在該文件上寫入一個字符串(Hello Java)。
你有什麼這麼遠嗎?您所使用的語法有沒有特別的困難? – Hannele
我不理解,如何創建文件以及如何寫入文件。對不起我的英語不好。 – alessandro