Java Data Types: Real Numbers, Characters, and Booleans

📘 Day 9 Learning Update | Data Types in Java (Continuation) On Day 9, I continued learning Data Types in Java, focusing on real numbers, character data, boolean values, and different integer representations. 🔹 Real Number Data Types Real numbers are used to store decimal values and are categorized into two types: 🔸 float Size: 4 bytes Precision: Single precision Range: −3.4 × 10³⁸ to +3.4 × 10³⁸ Requires an f suffix to avoid data overflow 🔸 double Size: 8 bytes Precision: Double precision Range: −1.7 × 10³⁰⁸ to +1.7 × 10³⁰⁸ Used when higher accuracy is required 📌 Both float and double values are stored in memory using the IEEE floating-point format. 🔹 Character Data Type Data type: char Size: 2 bytes Characters are stored using Unicode values Internally, characters are converted into binary (base-2) format before being stored in RAM 📌 ASCII (American Standard Code for Information Interchange) is used for basic character representation Example: 'A' → 65 🔹 Boolean Data Type Used to store true / false or yes / no Does not have a fixed size Size is JVM-dependent 🔹 Integer Literals Representation Java supports multiple ways to represent integer values: Decimal Integer – Base 10 (default) Octal Integer – Base 8 Starts with 0 Uses 3-bit representation Hexadecimal Integer – Base 16 Starts with 0x or 0X Uses 4-bit representation Binary Integer – Base 2 Starts with 0b or 0B This session helped me understand how different types of data are represented, stored, and processed at the memory level in Java, strengthening my foundation in core programming concepts. 🚀 Continuing to build strong fundamentals in Java step by step. #Java #DataTypes #JavaBasics #FloatingPoint #CharacterData #Boolean #ProgrammingFundamentals #LearningJourney #Day9Learning

  • graphical user interface, text, application

To view or add a comment, sign in

Explore content categories