package lianxi1;
import java.util.*;
import java.io.*;
import javax.swing.JFileChooser;
public class lianxi {
public static void main(String[] args) throws FileNotFoundException
{
/*JFileChooser filechooser=new JFileChooser();
if(filechooser.showOpenDialog(null)==JFileChooser.APPROVE_OPTION)
{
File file=filechooser.getSelectedFile();
Scanner input=new Scanner(file);
while(input.hasNext())
{
System.out.println(input.nextLine());
}
input.close();
}*/
File file=new File("image/zhang.txt");
PrintWriter output=new PrintWriter("image/zhang.txt");
System.out.println(file.getAbsoluteFile());
output.println("zhagh diao");
output.print("zhangbo");
output.close();
String a=new String();
String b=new String();
String c=new String();
Scanner input=new Scanner(file);
while(input.hasNext())
{
a=input.next();
b=input.next();
c=input.next();
}
System.out.println(a+"\n"+b+"\n"+c);
input.close();
}
}
java【源码】i/o乱七八糟
最新推荐文章于 2024-03-04 16:11:53 发布