Layers of Logic

Phase II

Data and Memory

Trace a Java value from source literal to bits, arithmetic, conversion, and output.

3 sections72 min of reading13 exercises

Declare and initialize Java's primitive types, then connect each numeric type to its representation. Derive signed integer ranges from fixed-width two's complement. Inspect IEEE 754 precision, rounding, subnormal values, infinities, and NaN. Finish by tracing widening, narrowing, constant-expression conversion, and numeric promotion through complete expressions.

When you finish this phase you can

  • Declare all eight primitive types and explain range, precision, and literal syntax
  • Treat char as a UTF-16 code unit and avoid assuming a boolean storage size
  • Decode fixed-width two's complement and predict integer overflow
  • Read normal and special IEEE 754 values and explain binary rounding
  • Choose an equality strategy that matches the numeric domain
  • Predict widening, narrowing, constant-expression conversion, and promotion
  • Explain why some widening primitive conversions lose precision
  1. 2.1Variables, Types, Literals, KeywordsGive a value a name, declare what that name can hold, and let the compiler check each use before the program runs.Primitive typesCore22 min5 exercises
  2. 2.2How Numbers Live in MemoryFixed-width two's complement represents signed integers. IEEE 754 represents binary floating point, including rounding and special values.Two's complementFloating pointDeeper26 min4 exercises
  3. 2.3Type Conversion, Promotion, CastingFollow the source type, the conversion rule, and the expression type to predict what Java keeps and what it loses.Type promotionCore24 min4 exercises