eclipse出现error:vector is a raw type。Reference to generic type Vector<E> should
部分程序如下:publicclassConnectionextendsThread{privateSocketnetClient;privateVector<Custom...
部分程序如下:
public class Connection extends Thread {
private Socket netClient;
private Vector<Customer> userOnline;
private Vector<Chat> userChat;
private ObjectInputStream fromClient;
private PrintStream toClient;
private static Vector vList = new Vector();//出现warning
····
}
····public void serverLogin() {
try {
Customer clientMessage2 = (Customer) obj;
// 读文件
FileInputStream file3 = new FileInputStream("user.txt");
ObjectInputStream objInput1 = new ObjectInputStream(file3);
vList = (Vector) objInput1.readObject();//出现warning
···
我是初学者,请各位大哥大姐多多提点!
··· 展开
public class Connection extends Thread {
private Socket netClient;
private Vector<Customer> userOnline;
private Vector<Chat> userChat;
private ObjectInputStream fromClient;
private PrintStream toClient;
private static Vector vList = new Vector();//出现warning
····
}
····public void serverLogin() {
try {
Customer clientMessage2 = (Customer) obj;
// 读文件
FileInputStream file3 = new FileInputStream("user.txt");
ObjectInputStream objInput1 = new ObjectInputStream(file3);
vList = (Vector) objInput1.readObject();//出现warning
···
我是初学者,请各位大哥大姐多多提点!
··· 展开
3个回答
展开全部
需要指定类型消除这个warning,例如存放int型
private static Vector <Integer> vList = new Vector<Integer>();
private static Vector <Integer> vList = new Vector<Integer>();
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
如果只是warning不是错误的话就不是大问题,一般可以忽略…………
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
这是警告可好?!提示你应该用泛型
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询