This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Hi Friends, I have classes(A,B..G) and roll numbers.I want to iterate through the data and put them into appropriate classes.Which data structure should i use??because I dont know before hand how many roll numbers might go into a class.I am trying to use a Object array like this:
Oject arr = new Object;
But the problem is I have to specify a "col" dimension,which i dont know and specifying something big impacts the performance.I dont think i can dynamically assign object like this:
Object = new Object(); Object = new Object(); ........ Object = new Object();
It sounds like you know there are seven classes, but don't know how may roll numbers there are. So you are correct that you need an array of something. The second level should be a data structure that can grow as needed, like an ArrayList. So now you have: ArrayList arr = new ArrayList;