Skip to content

Introduction to Java

Java’s “write once, run anywhere” uses the JVM as abstraction: Java compiles to bytecode that runs on the Java Virtual Machine, separating code from platform specifics. This portability, combined with strong typing and a massive ecosystem, made Java the backbone of enterprise computing.

Why it matters: Java powers millions of enterprise applications, Android apps, and big data platforms. Its tooling and libraries are unmatched in scope.

The key insight: Java’s garbage collector manages memory automatically, understanding object lifecycle is key to writing efficient, leak-free code.

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/finallycustom exceptions
  • Generics, type parameters, bounded types, wildcards, type erasure
  • Collections Framework, List (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
  • Concurrency, Thread, 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
  • Flashcards for rapid revision of key terms
  • Diagnostic tests to identify remaining gaps
  • Practice problems with detailed worked solutions
  • Cross-references to related topics