源代码是这样的:
- try {
- BufferedReader in = new BufferedReader(new FileReader("dept.txt"));
- Employee emp = new Employee();
- //PrintWriter out = new PrintWriter(new FileWriter("dept.txt"));
- //while((str = in.readLine()) != null){
- String str = in.readLine();
- textArea.setText(str);
- StringTokenizer tk = new StringTokenizer(str," ");
-
- emp.name = tk.nextToken();
- emp.dept = tk.nextToken();
- emp.salary = Double.parseDouble(tk.nextToken());
-
- stuff.addElement(emp);
-
- //textArea.setText(Integer.toString(stuff.size()));
-
-
- //}
- in.close();
- }
复制代码
但是在stuff.addElement(emp); 这句上出现问题(警告,但引起后续语句无法正常执行)。Eclipse的提示信息如下:
Type safety: The method addElement(Object) belongs to the raw type Vector.
References to generic type Vector<E> should be parameterized
其中stuff 是一个Vector实例对象。
我不明白应该怎样才能修正,哪位大哥能帮帮忙吗?谢谢了~
我的Java环境是 1.5 update 3 |