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, KeywordsStore values in variables and choose a type that fits the data.Primitive typesVariableStandard inputCore22 min5 exercises
  2. 2.2How Numbers Live in MemorySee how Java stores whole numbers and decimal approximations as bits.Two's complementFloating pointDeeper26 min4 exercises
  3. 2.3Type Conversion, Promotion, CastingPredict when Java changes a numeric type and what information the conversion can lose.Type promotionCore24 min4 exercises