0% found this document useful (0 votes)
18 views2 pages

Week 3

Uploaded by

raysleky
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views2 pages

Week 3

Uploaded by

raysleky
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

COMPILATION IN JAVA

INTRODUCTION
This guide is a basis for beginners in the field of program compilation
with a special focus on Java, a popular compiled language. Its goal is
to unmask the compilation process in a way that would make the
process easy to comprehend even for beginners and provide a good
starting point for further study.

PROGRAM COMPILATION
In programming, compilation is an important process where source
code in a high-level language is converted into machine code. This
process is essential as a computer can only run machine code. In
contrast to interpreted languages such as Python which are interpreted
line by line by an interpreter, compiled languages such as Java are
compiled into bytecode and can run on any system with a compatible
interpreter, the JVM.

JAVA AS A COMPILED LANGUAGE


What makes Java stand out among other programming languages
is its ‘write once, run anywhere’ principle. This is achieved through
its compilation process where Java code is compiled into
bytecode. This bytecode allows Java to be independent of the
platform, ensuring that Java programs can be executed on any
machine that has the JVM.

COMPILATION PROCESS

1
WRITING THE CODE
Java code is written in .java files.

2
COMPILATION
The Java Compiler (javac) translates the Java code
into bytecode, stored in .class files.

3
EXECUTION
The JVM executes the bytecode, making the program
run.

References:
Diehl, S. (1998). A formal introduction to the compilation of Java. Software: Practice and
Experience, 28(3), 297-327.
Fulton, M., & Stoodley, M. (2007, March). Compilation techniques for real-time Java
programs. In International Symposium on Code Generation and Optimization (CGO'07) (pp.
221-231). IEEE.
APPENDIX
CODE

COMPILATION

OUTPUT RESULTS

You might also like