Reviewed by Aditya Kumar · Last reviewed 2026-03-24
**float (primitive):** Default 0.0f for class fields; locals must be initialized. **Float (wrapper):** Default null. Primitives can't be null; wrappers can. **When to Use:** Primitive for performance, arrays, computation. Float for generics (List<Float>), Optional, nullable...
float (primitive): Default 0.0f for class fields; locals must be initialized. Float (wrapper): Default null. Primitives can't be null; wrappers can.
When to Use: Primitive for performance, arrays, computation. Float for generics (List<Float>), Optional, nullable schema (DB NULL).
Production: DTOs from DB—use Float for nullable columns. Internal computation—use float. Auto-boxing cost in tight loops—prefer primitive.
float f; // 0.0 (field)
Float F; // null (field)
Red Flag: Using Float in hot loop (boxing overhead). Pro-Move: 'We use float[] for batch metrics; Float for API response where null means "unknown".'
According to DataEngPrep.tech, this is one of the most frequently asked Python/Coding interview questions, reported at 1 company. DataEngPrep.tech maintains an editor-reviewed database of 1,863 data engineering interview questions across 7 categories.