PreparedStatements are used to provide arguments to the query that makes a SQL query reusable. The code below shows how to do that:

Java Code:
PreparedStatement ps = conn.prepareStatement
("select * from tablename where name LIKE ?");
ps.setString(1, "value");