Object-Oriented Programming (OOP)
4. Introduction to Data Types
4.5. Additional Data Types
Some languages include other basic types:
Byte: A small integer, typically 8 bits (-128 to 127). Used for low-level data (e.g., file I/O).
Example: Java’s byte b = 100;
Null/None: Represents the absence of a value.
Example: Python’s x = None, Java’s x = null
Void: Used in languages like C/C++ to indicate no return value for functions.
Data Type | Python | Java | C++ |
Integer | int (unlimited) | int, long | int, long |
Float | float (double precision) | float, double | float, double |
Boolean | Bool | boolean | bool |
Character | No distinct type | char | char |
String | str (immutable) | String (immutable) | std::string (mutable) |