// TODO 自动生成的方法存根 //路径文件 File file = new File("F:"+File.separator+"work"+File.separator+"work"+File.separator+"write.txt"); //将文件引入到输出流中 PrintStream out = new PrintStream(new FileOutputStream(file,true)); //输出内容 //输出方式一 out.println("张三"); out.println("29"); out.println("安徽"); out.println(23.4); out.println(23); //输出流二 String name = "李四"; int age = 33; out.printf("姓名:%s; 年龄:%s", name, age); out.close();