1. Difference between a PreparedStatement and Statement
This is best answered by looking at the
JavaDocs
2. When I should go for a PreparedStatement and when for Statement?
There is not absolute rule, but a general rule of thumb could be to use PreparedStatments for the vast majority of operations with the possible exception of running adhoc queries that change frequently. PreparedStatements hide a lot of the issues surrounding formatting and escaping characters in SQL queries etc. They are also compiled and added to a cache, so should perform better over time.
3. Which is better of the two in performance?
See above. Of course query performance is a much bigger topic than a simple choice of whether to use Statements or PreparedStatements.
4. I heard that PreparedStatement and Statement take different no. of interations when used in a loop - Is that correct?
Where did you hear that? What makes you think this would be the case?