Skip to content

Introduction to Java

This resource is created as an aggregation of best practices in Java. If you are learning Java for a specific course, please refer to the IB Computer Science notes on this site for JETS.

  • Syntax and semantics — primitive types, operators, control flow, arrays
  • Object-oriented programming — classes, objects, inheritance, polymorphism, interfaces, abstract classes
  • Exception handling — checked vs. unchecked exceptions, try/catch/finally, custom exceptions
  • Generics — type parameters, bounded types, wildcards, type erasure
  • Collections FrameworkList (ArrayList, LinkedList), Set (HashSet, TreeSet), Map (HashMap, TreeMap); choosing the right collection
  • Streams API — functional-style operations on collections: filter, map, reduce, collect
  • I/O — byte streams, character streams, buffered I/O, NIO
  • ConcurrencyThread, Runnable, ExecutorService, synchronized, java.util.concurrent
  • Effective Java items — favour composition over inheritance, program to interfaces, minimise mutability
  • Design patterns — Singleton, Factory, Observer, Strategy, Builder
  • Testing — JUnit 5, test-driven development, mocking with Mockito
  • Build tools — Maven and Gradle project structures, dependency management

All code examples compile under Java 17 (LTS) unless otherwise noted.

This introduction provides comprehensive coverage of Java content for the Languages qualification, with detailed explanations, worked examples, and practice questions aligned to the specification.

This page includes:

  • Key Definitions: Precise explanations of essential concepts
  • Core Concepts: Detailed treatment of fundamental principles
  • Worked Examples: Step-by-step solutions demonstrating application
  • Practice Questions: Examination-style questions with mark schemes
  • Common Pitfalls: Frequent errors and how to avoid them
  • Exam Tips: Strategies for maximising marks
  1. Read through the introductory material to establish context
  2. Study the definitions and core concepts carefully
  3. Work through the worked examples, following each step
  4. Attempt the practice questions independently
  5. Review your answers against the provided solutions
  6. Note any areas requiring further revision
  • Foundational definitions and terminology
  • Application of principles to examination contexts
  • Connections to related topics within the specification
  • Assessment objective alignment
  • Active Recall: Test yourself on the material rather than passively re-reading
  • Spaced Repetition: Review this content at increasing intervals
  • Interleaving: Mix this topic with others during study sessions
  • Elaborative Interrogation: Ask yourself why each concept works

Practise applying these concepts under timed conditions. Focus on understanding what each question is asking and how marks are allocated. Review examiner reports to learn from common mistakes made by other students.

  • Flashcards for rapid revision of key terms
  • Diagnostic tests to identify remaining gaps
  • Practice problems with detailed worked solutions
  • Cross-references to related topics

This introduction provides comprehensive coverage of Java content for the Languages qualification, with detailed explanations, worked examples, and practice questions aligned to the specification.

This page includes:

  • Key Definitions: Precise explanations of essential concepts
  • Core Concepts: Detailed treatment of fundamental principles
  • Worked Examples: Step-by-step solutions demonstrating application
  • Practice Questions: Examination-style questions with mark schemes
  • Common Pitfalls: Frequent errors and how to avoid them
  • Exam Tips: Strategies for maximising marks
  1. Read through the introductory material to establish context
  2. Study the definitions and core concepts carefully
  3. Work through the worked examples, following each step
  4. Attempt the practice questions independently
  5. Review your answers against the provided solutions
  6. Note any areas requiring further revision
  • Foundational definitions and terminology
  • Application of principles to examination contexts
  • Connections to related topics within the specification
  • Assessment objective alignment
  • Active Recall: Test yourself on the material rather than passively re-reading
  • Spaced Repetition: Review this content at increasing intervals
  • Interleaving: Mix this topic with others during study sessions
  • Elaborative Interrogation: Ask yourself why each concept works

Practise applying these concepts under timed conditions. Focus on understanding what each question is asking and how marks are allocated. Review examiner reports to learn from common mistakes made by other students.

Java is the language of “write once, run anywhere.” It compiles to bytecode that runs on the JVM, providing platform independence. Everything is an object (except primitives), and inheritance is the primary code reuse mechanism. The JVM handles memory management through garbage collection, so you do not free memory manually. Java’s strength is its mature ecosystem: millions of libraries, frameworks (Spring, Hibernate), and tools. The language evolves steadily, adding records, sealed classes, and pattern matching while maintaining backward compatibility.