On this page
  1. primitives
  2. Availability
  3. Syntax & Overview
  4. Notes & Pitfalls
  5. Example

primitives

Prev: `RuntimeException` | Up: builtins | Next: `switch expressions`
Rel: builtins, Classes, Records & Sealed Hierarchies
Ref: Java Docs — primitives
Tags: #public #prog #java #builtins #tier/core


Availability

Built-in / java.lang (Built-in Value Types) — available with zero import statements.

Syntax & Overview

boolean, byte, short, char, int, long, float, double

8 stack-allocated unboxed value types (zero object header overhead), each paired with a boxed wrapper (Integer, Long, etc.).

Notes & Pitfalls

Example

int count = 1_000_000;
long big = 10_000_000_000L; // trailing L required for >32-bit literals
assert count > 0 && big > count;

Linked from

Related notes