error
Hey guys I am a new java programmer.......I have a class firmobj abd a vector vec1....here I have created a firm object and assigned the vector vec1 to it.....I have type casted it as below. But I got the following error.
firmobj firm = (firmobj) vec1;
error: the type of the expression must be an array but resolves to vector.
Below is a part of the code ......vec1 has been declared an array and firmobj is a class with getters and setters to make an object.
Vector vec1 = new Vector();
while(table1.next()) {
firmobj1 firm = new firmobj1();
firm.setFirmID(table1.getInt("org_id"));
firm.setDsclCode(1);
firm.setCount(table1.getInt("counts"));
vec1.add(firm);
}
for(int i=0;i<vec1.size();i++) {
firmobj1 firm = (firmobj1) vec1;
}>
Vector vec1 = new Vector();
while(table1.next()) {
firmobj1 firm = new firmobj1();//firmobj is a class in the same package and extends nothing
firm.setFirmID(table1.getInt("org_id"));//table1 is resultset variable whih extracts data from DB table
firm.setDsclCode(1);
firm.setCount(table1.getInt("counts"));
vec1.add(firm);// adds the object firm to the vector
}
for(int i=0;i<vec1.size();i++) {
firmobj1 firm = (firmobj1) vec1;//trying to display the data from vector using the get methods inthe
// firm obj. but gives ann srror as mentioned in the first post
}>