C
column
//have simple class:
public class stud {
public String getData() {...}
...............
}
//And I have class that contains many of stud in collection data
public class studc {
ArrayList data = new ArrayList();
...............
//it is easy to add class in collection
public void add(stud s)
{
data.add(s);
}
public String enumerate()
{
String s = new String();
for (int i=0; i<data.size(); i++)
{
studentas f = data.get(i);
// !!!! it is not possible to get stud type element from colection
because arraylist returns
//only Object (not stud class)
s=s + f.getData()+"\n";
}
return s;
}
}
How to get stud type object from data?
public class stud {
public String getData() {...}
...............
}
//And I have class that contains many of stud in collection data
public class studc {
ArrayList data = new ArrayList();
...............
//it is easy to add class in collection
public void add(stud s)
{
data.add(s);
}
public String enumerate()
{
String s = new String();
for (int i=0; i<data.size(); i++)
{
studentas f = data.get(i);
// !!!! it is not possible to get stud type element from colection
because arraylist returns
//only Object (not stud class)
s=s + f.getData()+"\n";
}
return s;
}
}
How to get stud type object from data?