Statement vs PreparedStatement vs CallableStatement in JDBC
Statement runs static SQL, PreparedStatement binds parameters safely, and CallableStatement calls stored procedures. Learn which to use and why.
Spread Your Knowledge. Questions with answers, tutorials and articles, newest first.
Statement runs static SQL, PreparedStatement binds parameters safely, and CallableStatement calls stored procedures. Learn which to use and why.
Connect Java to a database with JDBC using try-with-resources, PreparedStatement, transactions and a HikariCP pool, with the current MySQL driver.
JDBC is the standard Java API for connecting to relational databases, running SQL and managing transactions. See how it works with current best practices.
MVC splits a Java application into model, view and controller. See how it works with a plain Java example and Spring MVC.
JSP turns HTML templates into servlets. Learn the lifecycle, the elements, a modern Jakarta example with EL and JSTL, and when to choose alternatives.
A servlet is a Java class run by a web container that turns HTTP requests into responses. Learn the lifecycle, a working example and how it relates to Spring MVC.
Java applets ran in browser plug-ins until browsers dropped them. See the lifecycle, why they ended and the modern alternatives to migrate to.
Build a Java Swing GUI with JFrame, JLabel and JButton, learn layout managers, event listeners, SwingWorker and why the EDT matters.
JavaFX is Java's modern toolkit for desktop UIs, with a scene graph, CSS, FXML, and bindings. See how it works and run your first app.
Write a .java file, compile it to bytecode with javac, and run it on the JVM with java. Includes packages, JARs and fixes for common errors.
The Java API is the standard library that ships with the JDK. See its main packages, how to use it, and how to read the Javadoc.
javac turns Java source into platform-independent bytecode and catches errors early. See its phases, key options and how the JVM runs the result.
The JRE is the JVM plus class libraries needed to run Java programs. Learn how it differs from the JDK, why separate JREs ended after Java 11, and how jlink replaces it.
The JDK bundles the Java compiler, JVM, class library and tools. Learn how it differs from the JRE and JVM and which LTS version to install today.
Command-line arguments reach Java in the args array of main. Learn to read, validate and parse them, from simple loops to picocli.
main() is the entry point the JVM calls to run a Java program. See the classic signature, what each keyword means, and the simplified main added in Java 25.
Serializable writes fields automatically; Externalizable makes you write them yourself. See the differences, a runnable example and modern alternatives.
Implement Serializable, write with ObjectOutputStream and read with ObjectInputStream. Covers serialVersionUID, transient, security and alternatives.
Java serialization turns an object's state into a byte stream and back. Learn how Serializable works, how to version classes, and why filters matter.
Use Files.readString and Files.writeString for small files, buffered readers for large ones, and try-with-resources always. Includes the legacy java.io approach.