C#
File.WriteAllText("test.txt", "abcdefg");

Java
Files.write(Paths.get("test.txt"), Arrays.asList("abcdefg"));

C#の方が簡単、つまり