For questions like that it is generally always a good idea to ask them to clarify and define what they mean in regards to learning Java and then adjust your honest assessment on the basis of what they are looking for as a response. Likewise, how they answer could also give you some insight into what sort of employer they might be; remember, you are interviewing them as much as they are interviewing you.
In regards to the response you gave, I think it is actually a pretty fair answer although you could have hedged your bets by saying something along the lines of:
I feel that it would take me two to three months to be reasonably well versed in the language and to be able to independently develop programs without much help; however, I could likely learn the basic syntax and be able to follow what existing code is doing within n number of days.
This would then answer their questions in two ways in that you are giving them an idea of when you might be useful to them (i.e. the initial learning time) followed by when you think you might achieve a reasonably level of competence with the language. However, as sashang noted, these questions are a bit of a minefield in that you really don't know what they are asking unless you ask them for clarification. If they don't want to give you clarification then it could be a sign that they might not be the ideal employer as it is reasonable for an employee to be able to expect to ask their supervisor or someone else they are working with for clarification on an assignment.