DEV Community

Cover image for πŸš€ Day 3 of My Automation Journey – Data Types, Memory & Variables in Java
bala d kaveri
bala d kaveri

Posted on • Edited on

πŸš€ Day 3 of My Automation Journey – Data Types, Memory & Variables in Java

On Day 3, we went deeper into:

JRE inside JVM
JVM and OS independence
Data Types
Memory concepts (Stack)
Variables & memory allocation

This was a very important foundation day.

πŸ” JVM and OS Independence

We learned that:

JVM makes Java platform independent

Java programs can run on Windows, Linux, or Mac

Only JVM needs to be installed for that OS

That’s why Java is called:

β€œWrite Once, Run Anywhere”

πŸ“¦** What is a Data Type?**

A Data Type defines:

What kind of value can be stored

How much memory it uses

Examples of values:
Numeric values (10, 100)
Decimal values (10.5, 20.75)
Special characters ('A', '@')
True/False

Think of a data type as a container.

You must choose the correct container for the value you store.

🧩 Two Types of Data Types in Java
1️⃣ Primitive Data Types

These store simple values directly.

Data Type   Size    Example
byte           1 byte   50
short          2 bytes  1000
int        4 bytes  100000
long           8 bytes  100000000L
float          4 bytes  10.5f
double       8 bytes    10.5678
char           2 bytes  'A'
boolean      1 bit (logical)    true/false
Enter fullscreen mode Exit fullscreen mode

🧠 Understanding byte

1 byte = 8 bits
2^8 = 256 values

Range of byte:

-128 to 127

So this is valid:

byte tamilMark = 50;
byte englishMark = 50;
Enter fullscreen mode Exit fullscreen mode

But this is NOT valid:

byte value = 200; // ❌ Out of range
2️⃣ Non-Primitive Data Type

These store references (not direct values).

Example:

String name = "Kaveri";
Enter fullscreen mode Exit fullscreen mode

String can store multiple characters.

We will study String in detail separately (very important topic).

🧠 Primitive vs Non-Primitive (Major Difference)

** Primitive            Non-Primitive**
Stores actual value Stores reference (address)
Fixed size          Size depends on object
Stored in stack Stored in heap (reference in stack)
Example: int, byte  Example: String
Enter fullscreen mode Exit fullscreen mode

🧠 Memory Concept (Simple Understanding)

We learned about:

πŸ”Ή** Stack Memory**

Stores primitive variables

Stores variable references

Example:

int tamil = 70;

Here:

int β†’ data type

tamil β†’ variable name

= β†’ assignment operator

70 β†’ value

; β†’ end of statement

🏷 What is a Variable?

Variable = Name of the memory location.

Example:

byte tamil_mark = 70;
byte eng_mark = 60;
Enter fullscreen mode Exit fullscreen mode

Just like two students cannot have the same roll number,
Java does not allow duplicate variable names in the same scope.

🧠 Breaking Down This Line
byte tamil_mark = 70;

byte β†’ data type
tamil_mark β†’ variable name
= β†’ assignment operator
70 β†’ value
; β†’ statement terminator

The semicolon tells Java:

The line of code is complete.

πŸ’» Checking System RAM

We also learned how to check system memory:

Right-click This PC
Click Properties
View installed RAM

Memory matters because:

JVM uses system memory
Applications allocate memory during runtime

🎯** Day 3 Reflection**

Today I understood:

βœ” What data types are
βœ” Difference between primitive and non-primitive
βœ” Memory basics (Stack concept)
βœ” Why variable names must be unique
βœ” How byte range is calculated

Strong fundamentals in Java will directly help in:

Selenium automation
Handling test data
Writing efficient scripts

Every day, I’m getting one step closer to my goal:

πŸ’Ž Becoming a Master in Automation Testing using Selenium and Playwright.

Date: 20/02/2026
Trainer:Nantha from Payilagam

πŸ€– A Small Note

I used ChatGPT to help me structure and refine this blog.

Top comments (0)