Skip to content

YuriiJavaDev/JavaBasics_Task_7

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Memory Allocation & Concatenation (JavaBasics_Task_7)

📌 Description

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.

🚀 Task Requirements

  1. Declare and initialize:
    • byte (b)
    • int (i)
    • double (d)
  2. Output the memory size for each type along with its current value using concatenation.

🛠 Data Types & Memory

  • 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.

🛠 Technical Stack

  • Language: Java 23
  • IDE: IntelliJ IDEA
  • Concepts: String concatenation, Primitive data types, Memory allocation.

⌨️ Practical Implementation

The code follows Java naming conventions and clean code principles.

💻 Code Example

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");
    }
}

⚖️ License

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

About

Educational project. JavaBasics_Task_7 Analysis of how much memory different data types take up. 140126_1529

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages