黑马程序员技术交流社区

标题: 九九乘法表打印到文档里怎么弄? [打印本页]

作者: 范康    时间: 2016-4-15 22:01
标题: 九九乘法表打印到文档里怎么弄?
九九乘法表打印到文档里怎么弄?
作者: 小流氓    时间: 2016-4-15 23:05
public class WriteDemo {
        public static void main(String[] args) throws IOException {
               
                //创建一个字节输出流
                OutputStream out = new FileOutputStream("D:\\dy.txt");
                BufferedWriter buf = new BufferedWriter(new OutputStreamWriter(out));
                for (int x = 0; x < 5; x++) {
                        for (int y = 0; y <4; y++) {
                                //System.out.print("*");
                                buf.write("*");
                               
                        }       
                        buf.newLine();
                        //System.out.println();
                       
                }
                buf.close();
               
        }
}
把*替换成99乘法表的打印方式就可以了




欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2