Hello i was just thinking of how the Keywords in java are Implemented . Can any one help me in understanding the fundamentals behind that
To clear my doubt i have an example
Here in above example "for" loop is the key word used . There is mechanism which invokes the for loop . how would be tho code @ the back end which initializes increments and checks for every execution . This is a case for "for loop " similarly there are other keywords like "while" "do while" .
Please help me out in Understanding the same .. Thanks in advance .
Joined: Jun 07, 2007
As per my knowledge, there are 2 parts the answer you need.
1. Java Compiler(javac)
If you have studied compilers, you should be familiar with the code generation mechanism. The code generated here, is Byte-Code, Bytecode are instructions which has, menomonic and opcode alike we have in x86 programming language. It is RISC instruction set.
For each construct like for, while, do-while, etc you have skeleton of code construct ready, it is just filled in and written to your .class file.
Now this .class file can be read by any VIRTUAL Machine which accepts bytecodes. In our case we use JVM.
Now, here is the thing which runs your byte code. Alike we have processor to run machine instructions, we have JVM to run bytecode. But JVM is not a hardware entity, its a program in execution.
JVM has its register set, databus etc. implemented. These things are either implemented in CODE or it relies on capabilities of underlying hardware.