我不知道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