English
Review questions
Questions for self-check and exam preparation, grouped by course topic.
Topic 1. Java and your first program
- What is the Java platform? Explain the purpose of the JVM, JRE, and JDK.
- Explain how a Java program is compiled and executed: bytecode, the class loader, JIT compilation.
- Describe the structure of a Java program: a class, the main method, packages, imports.
- How do you create, run, and debug a Java project in IntelliJ IDEA? Which JDK tools (javac, java, jshell) do you know?
- What is the Git version control system? Explain the concepts of a repository, a commit, and a branch, and the basic Git commands.
- How do you work with a Git repository in IntelliJ IDEA? Which Java project files should be added to .gitignore?
Topic 2. Types and control flow
- What primitive data types does Java have? Give their sizes and value ranges.
- Compare primitive and reference types. What are wrapper classes, autoboxing, and unboxing?
- Explain implicit and explicit type conversion and local variable type inference (var).
- Which operators does Java support? Explain operator precedence and integer division.
- How do you perform console input with the Scanner class and formatted output with printf?
- Describe Java's control structures: if, the switch statement and expression, and the for, while, do-while, and for-each loops.
Topic 3. Methods, arrays, and strings
- Explain method declarations, pass-by-value parameter passing, and method overloading.
- What are variable-argument methods (varargs) and recursive methods?
- How do you declare, create, and initialize one-dimensional and multidimensional arrays? Which methods does the Arrays class provide?
- Why are String objects immutable? What is the string pool, and how should strings be compared?
- Compare the String, StringBuilder, and StringBuffer classes.
- What are text blocks and string formatting methods (formatted, String.format)?
Topic 4. Exceptions and debugging
- Describe the Java exception hierarchy: Throwable, Error, Exception, RuntimeException.
- Compare checked and unchecked exceptions.
- Explain how try, catch, and finally blocks and multi-catch work.
- What is the try-with-resources statement and the AutoCloseable interface?
- How do you create your own exception class? What is exception chaining?
- Which debugging tools does IntelliJ IDEA provide: breakpoints, stepping, expression evaluation?
Topic 5. Classes and objects
- What are a class and an object? How is an object created, and where is it placed in memory?
- Explain constructors, constructor overloading, and calling this(…).
- What is encapsulation? Explain the access modifiers public, protected, and private, and package-private access.
- What are static fields, static methods, and initialization blocks? What is the final keyword used for?
- What are packages in Java? How are they related to the project's directory structure?
- How does the garbage collector work in the JVM? What are unreachable objects?
- What are immutable classes, and how do you create them?
Topic 6. Inheritance and polymorphism
- What is inheritance? Explain the extends and super keywords.
- What is polymorphism? Explain method overriding and the @Override annotation.
- Compare method overloading and overriding.
- Which methods does the Object class define? Why override equals, hashCode, and toString?
- Explain upcasting and downcasting and the instanceof operator.
- What are final classes and final methods used for?
Topic 7. Abstraction and interfaces
- What are an abstract class and an abstract method?
- What is an interface? Explain default, static, and private interface methods.
- Compare abstract classes and interfaces. When should you use each of them?
- Explain the kinds of nested classes: static nested, inner, local, and anonymous classes.
- What are anonymous classes used for? Compare them with lambda expressions.
- Explain the standard Comparable and Comparator interfaces.
Topic 8. Records, enums, sealed classes
- What are records? Which methods does the compiler generate for a record automatically?
- What are enums? How do you add fields, constructors, and methods to an enum?
- What are sealed classes and interfaces? Explain the permits and non-sealed keywords.
- Explain pattern matching for instanceof and in the switch statement.
- What are record patterns and record deconstruction?
- How do sealed hierarchies help check the exhaustiveness of switch branches?
Topic 9. Generics
- What are generics? What advantages do generic classes and methods provide?
- Explain the declaration of generic classes, interfaces, and methods.
- What are bounded type parameters (extends)?
- Explain the wildcards ?, ? extends T, and ? super T, and the PECS principle.
- What is type erasure? What restrictions does it impose on generics?
- What are raw types, and why should you avoid them?
Topic 10. Collections
- Describe the interface hierarchy of the Java Collections Framework: Collection, List, Set, Queue, Map.
- Compare the ArrayList and LinkedList list implementations.
- Compare the HashSet, LinkedHashSet, and TreeSet set implementations.
- Compare the HashMap, LinkedHashMap, and TreeMap map implementations. How does HashMap work?
- Explain queues and deques: Queue, Deque, ArrayDeque, PriorityQueue.
- How do you traverse collections with an iterator and a for-each loop? What is ConcurrentModificationException?
- Compare unmodifiable collections (List.of, Map.of) and mutable collections. Which methods does the Collections class provide?
Topic 11. Lambdas and the Stream API
- What are lambda expressions? Explain their syntax and variable capture.
- What are functional interfaces? Explain the Function, Predicate, Consumer, and Supplier interfaces.
- What are method references? Give examples of their kinds.
- What is the Stream API? Compare intermediate and terminal stream operations.
- Explain the stream operations filter, map, flatMap, sorted, reduce, and collect.
- How do you group and aggregate data with the Collectors class (groupingBy, joining, toMap)?
- What is the Optional class, and what is it used for?
Topic 12. Files, NIO.2, and serialization
- Compare Java's byte and character I/O streams.
- How do you read and write text files with BufferedReader and BufferedWriter?
- What capabilities does NIO.2 provide: the Path, Paths, and Files classes?
- How do you browse directory contents and process files with the Files.walk and Files.lines methods?
- What is object serialization? Explain the Serializable interface and the transient keyword.
- What security risks does standard Java serialization have? Which alternative serialization formats (JSON) do you know?
Topic 13. Modules, builds, and testing
- What is the Java Platform Module System (JPMS)? Explain the module-info.java file and the requires and exports directives.
- What is the Maven build system? Explain the pom.xml file, dependencies, and the build lifecycle.
- What is the Gradle build system? Compare Gradle and Maven.
- What is unit testing? Explain the JUnit 6 annotations (@Test, @BeforeEach, @ParameterizedTest).
- Explain the methods of the Assertions class and testing exceptions in JUnit.
- How do you run tests in IntelliJ IDEA and with Maven or Gradle? What is test code coverage?
Topic 14. Databases and JDBC
- Explain the basic concepts of relational databases and SQL: tables, keys, relationships, and the SELECT, INSERT, UPDATE, and DELETE statements.
- How do you create a PostgreSQL database and work with it in JetBrains DataGrip?
- What is JDBC? Describe the Connection, Statement, PreparedStatement, and ResultSet interfaces.
- How do you add the PostgreSQL JDBC driver to a project and connect to a database?
- Why should you use PreparedStatement? How does it protect against SQL injection?
- How do you perform transactions in JDBC (setAutoCommit, commit, rollback)?
- What is a connection pool? How do you implement the DAO pattern for data access?
Topic 15. JavaFX graphical applications
- Describe the architecture of a JavaFX application: the Application, Stage, and Scene classes, and the scene graph.
- Which basic JavaFX controls do you know? Explain their common properties.
- Explain the JavaFX layout panes: VBox, HBox, BorderPane, GridPane, StackPane.
- How do you handle events in JavaFX? Explain event handlers and lambda expressions.
- What are FXML and Scene Builder? How do you connect FXML markup to a controller class?
- How do you style a JavaFX interface with CSS?
Topic 16. MVC and data binding
- Describe the MVC architecture and its implementation in JavaFX applications.
- What are JavaFX properties (Property)? Explain one-way and two-way data binding.
- What is an ObservableList? How do you display data in TableView and ListView controls?
- How do you run long operations on a background thread with Task without blocking the JavaFX interface?
- How do you organize database access from a JavaFX application through a DAO layer?
- How do you build and distribute a JavaFX application (jlink, jpackage)?