//Sample06_01.java import java.io.File; import java.io.FileOutputStream; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.io.IOException; import java.io.UnsupportedEncodingException; class Sample06_01{ public static void main(String[] args){ String path = "hello.txt"; File file = new File(path); String[] strs = { "赤い彗星", "青い彗星", "黄色い彗星", "ピンクの彗星", "緑色の彗星" }; try { BufferedWriter br = new BufferedWriter( new OutputStreamWriter( new FileOutputStream(file), "UTF-8" ) ); for(String str :strs){ br.write(str); br.newLine(); } br.close(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (IOException e){ e.printStackTrace(); } } }