- package FilePakage;
- import java.io.*;
- import java.util.Enumeration;
- import java.util.Properties;
- import java.util.Vector;
- public class PropertiesDemo
- {
- public static void main(String[] args) throws IOException
- {
- FileOutputStream fileo = new FileOutputStream("E://text.txt");
- Vector<Person> v = new Vector<Person>();
- v.add(new Person("苍井空1",21));
- v.add(new Person("苍井空2",22));
- v.add(new Person("苍井空3",23));
- byte[] buf = new byte[1024];
- int len = 0;
-
- fileo.close();
- }
- }
- class Person
- {
- private String name;
- private int age;
- Person(String name,int age)
- {
- this.name = name;
- this.age = age;
- }
- public String toString()
- {
- return name+" "+age;
- }
- }
复制代码 上面的例子我想要 通过泛型手动输入元素 然后再存储在 指定文件中
不知道怎么写了 知道的大神教下
|
|