This content originally appeared on DEV Community and was authored by MANIKANDAN
Why have I chosen this topic, " Ask why every time"
because I started with the topic (type casting), after
thinking why and how it is working, I got more interested
In programming, when we understand how it works in the
Background: We will start enjoying anything, now I will
Say how it went for me
I started with the type casting topic
What is type casting?
-->Type casting is when you assign a value from one primitive data
type to another type
What is a primitive data type?
--> primitive data type is a raw material (bricks, cement)
--> They store value directly in the memory
--> It is stored in stack memory
What is stack memory?
--> Stack is memory in jvm that is used to store
--> Method call()
--> Local variable
--> When the work is over, it will be cleared from the stack
How is the code running behind? Do you ever think about it in java?
-> Example:-
int x=10; // still just a text
|
javac // This will check your code, like spelling,
| semicolons, curly brackets, any keywords
| used a variable name, etc
|
|
If everything is correct, it will convert the Java file
into bytecode, that is, nothing but a .class file
|
|
Still, no memory is allocated
to the variable
|
|
java(file name) // After this jvm comes
| JVM executes the bytecode line by
| line
|
JVM finds free space in the stack memory
|
|
Allocate 4 bytes // it is an integer, so 4 bytes
|
|
store value inside and maps variable name to that memory location
|
|
The execution engine goes instruction by instruction
|
Execute the program output
In the next blog, we can see in detail about Type casting
This content originally appeared on DEV Community and was authored by MANIKANDAN

MANIKANDAN | Sciencx (2025-08-26T11:51:33+00:00) Ask why every time…... Retrieved from https://www.scien.cx/2025/08/26/ask-why-every-time/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.