None of them will be executed until someone takes this new object pointed to by "retValue" and calls them. As this object is the return value of this method, we don't see any of its methods being called here (well, except that "toString()" is implicitly called in the println() call.)
I have traced through the logs and now I can very well understand what is the execution flow of this code.
The other thing which is coming up in my mind is what is the benifit of doing this. If instead of defining these methods here, we could also define these methods as private in the DBIterator Class also. But why this way ?
In this particular case I see no advantage to using this inner class. You could just as well use a top-level class, and the code would be clearer (i.e., we never would have had this discussion!) The top-level class's constructor would need three arguments: startDate, endDate, and longPK would need to be passed in.
In other cases, though, if a class is short and needs to use member variables of the enclosing class, it makes sense to use an inner class. By "short" I mean less than ten lines, generally.