Java 乘法 table, Writer 写在第二行而不是第一行

Java multiplication table, Writer writes in second line instead of first

应该是正方形的乘法table, 但是作者没有在第一行第一列写数字

try {
    File file = new File("multi.txt");
    // FileWriter Writer = new FileWriter("multi.txt");

    BufferedWriter Writer = new BufferedWriter(new FileWriter(file));
        
    for (int o = 1; o <= n; o++) {
        Writer.write ("\n");
        for (int s = 1; s <= n; s++) {
            if (o * s < 10) Writer.write( " ");
            if (o * s < 100) Writer.write( " ");
            // System.out.print( "  " + z * s);
            Writer.write ("    " + o * s);
        }
    }
    Writer.close();

应该这样做:

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;

public class tmp {

    public static void main(String[] args) {

        try {

            File file = new File("multi.txt");
            // FileWriter Writer = new FileWriter("multi.txt");

            BufferedWriter Writer = new BufferedWriter(new FileWriter(file));
            int n = 10;
            
            for(int o = 1; o <= n; o++) {
                for(int s = 1; s <= n; s++) {
                    Writer.write(o*s+"\t");
                }
                Writer.write("\n");
            }
            Writer.close();
        } catch (Exception e) {
            System.out.println("exception thrown");
        }
    }
}