This project focuses on understanding the memory footprint of different primitive data types in Java. It demonstrates how to combine descriptive text with actual variable values using string concatenation.
- Declare and initialize:
byte(b)int(i)double(d)
- Output the memory size for each type along with its current value using concatenation.
byte: 1 Byte. Used for small integer values.int: 4 Bytes. Standard size for integer arithmetic.double: 8 Bytes. Used for floating-point numbers requiring high precision.
- Language: Java 23
- IDE: IntelliJ IDEA
- Concepts: String concatenation, Primitive data types, Memory allocation.
The code follows Java naming conventions and clean code principles.
package com.yurii.pavlenko;
public class Task_7_App {
public static void main(String[] args) {
byte b = 10;
int i = 1000;
double d = 99.99;
System.out.println("byte (value: " + b + ") — 1 byte");
System.out.println("int (value: " + i + ") — 4 bytes");
System.out.println("double (value: " + d + ") — 8 bytes");
}
}This project is licensed under the MIT License.
Copyright (c) 2026 Yurii Pavlenko
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files...
License: MIT