↳
The question is actually quite simple since you were given that Comparable interface is already implemented (eg, public int compareTo(Object o) method is overridden in Person object). First step, 'read from a file all records' and store each Person object returned by getNextPerson() in List records = new ArrayList(). Next step, call Collections.sort(records) to sort (by criteria specified in compareTo() method, such as Last and First name, or any other meaningful parameter). Final step, 'give first 1000 records' -- either by iterating over first 1000 (checking size() >= 1000) or by returning the list consisting of only 1000 records (either copy into a new list with size 1000 or by using removeRange method in ArrayList. Less
↳
maybe use tree data structure
↳
tree data structure ? i hope u meant to say "TreeSet"; but the question doesnt say that getNextPerson() will be unique. So let us not bank on treeSet. So just add them on to a arrayList and do a Collections.sort(arrayList); Less
↳
It is a platform independent programming language
↳
java is a programming language and it is a platform independent .
↳
Java is a high level, platform independent, object oriented, programming language Less
↳
consider using only 1 loop
↳
1 loop only if 2 it becomes n2
↳
use loop meaning 1 loop? or 1 inside of another?
↳
The first line is A ctor as the first line of any constructor is super()
↳
B ctor B ctor B ctor A ctor A ctor
↳
Aptitute
↳
I clear three rounds of interview but I did not select for that job.
↳
Since I was a heads down programmer, I was not well versed with those kind of "GOTCHA" questions., even though my friend warned me that they may ask those cliché questions... Less