What are difference between PreparedStatement and Statement in jdbc?

1. PreparedStatement will be used for executing SQL statements many times dynamically.It will accept input parameters.
2. PreparedStatement interface (extending Statement) executes a precompiled SQL statement with/without parameters.
3. PrepareStatement is used foe dynamic queries i.e. DML query.
4. In prepareStatement query is precompiled because of this prepareStatement is time efficient.
5. PrepareStatement takes argument at the time of creation.
Example : we can create table(static) by using Statement.

Statement :-
1. Statement is static and prepared statment is dynamic.
2. Statement is suitable for DDL and prepared statment for DML.
3. Statement is slower while prepared statement is faster.
4. Statement will be used for executing static SQL statements and it can’t accept input parameters.
5. Statement interface executes static SQL statements without parameters.
6. Statement is used for static queries means DDL queries i.e. create,drop,alter.
7. In Statement, the query is not precompiled.
8. Statement doesnot take arguments at the time of creation.
Example: we can Insert element (dynamic)by using prepareStatement.