CLASS : VIII
SUBJECT : COMPUTER APPLICATIONS
CHAPTER -2
TOPIC : INTRODUCTION TO
JAVA
SOURCE CODE & OBJECT CODE
SOURCE CODE : A set of instructions written in
high level programming language is called
source code.
OBJECT
SOURCE LANGUAGE
CODE / MACHINE
CODE TRANSLATOR CODE
OBJECT CODE : A compiler generated machine
language version of the source code is called object
code .
LANGUAGE TRANSLATOR
LANGUAGE TRANSLATOR : A language translator is
a software that converts a source code written any
programming language into machine code.
There are three types of translator :
i) Assembler ii) Interpreter iii) Compiler
i) Assembler : It is a software that converts a program
written in assembly-level language into its equivalent
machine code.
SOURCE OBJECT
CODE ( Assembly ASSEMBLER CODE ( MACHINE
Language ) LANGUAGE CODE )
ii)Interpreter : It is a translator that converts or
interprets a program written in high-level language
line–by-line into its equivalent machine co de.
SOURCE OBJECT
CODE ( High Level INTERPRETER CODE ( MACHINE
Language ) LANGUAGE CODE )
It is a translator that converts a whole
iii) Compiler :
program written in high-level language into its
equivalent machine code at a time.
SOURCE OBJECT
CODE ( High Level COMPILER CODE ( MACHINE
Language ) LANGUAGE CODE )
DIFFERENCE BETWEEN
COMPILER AND INTERPRETER
COMPILER INTERPRETER
1 Compiler compiles the program 1. Interpreter converts one
as whole . statement program at one
time.
2. Compiler generates object file. 2. Interpreter generates no
object file.
3. Compiler translation is fast. 3. Interpreter translation is
slow.
JAVA – OBJECT ORIENTED
PROGRAMMING LANGUAGE
JAVA is a third generation object
oriented programming language. It is a platform
independent language. Java language initially
called Oak but was renamed Java. It can be used
to create user-friendly computer applications that
can run on a stand-alone machine. It can be
used to build application modules .
JAVA PROGRAMS
There are two types of Java programs :
i) Stand –alone Applications ii) Internet Applets
i) Stand –alone Applications : A stand –alone
application refers to a java program that can run
independently on a computer.
There are two types of Java Stand-alone
applications :
a) Console Based applications
b) Graphical User based applications
ii) Internet Applet : Java applets are java
applications that run within a web browser , they
are mainly used for internet programming.
FEAUTRES OF JAVA
The main features of Java language are as
follows :
1. SIMPLE
2. ROBUST
3. SECURE
4. OBJECT ORIENTED PROGRAMMING
5. PLATFORM INDEPENDENT
6. MULTITHREADED
TRADITIONAL COMPILATION
PROCESS
The process of converting source code written in
High -level language into machine code ( object
code), is called compilation. Every high –level
language has its own compiler that converts
source code into machine language.
This process is called traditional compilation
process.
WINDOWS MACHINE
WINDOWS
LANGUAGE
COMPILER (OBJECT CODE)
SOURCE CODE
UNIX MACHINE
UNIX
LANGUAGE
COMPILER (OBJECT CODE)
JAVA COMPILATION PROCESS
JAVA VIRTUAL MACHINE (JVM) : JVM stands for Java Virtual
Machine. It is a virtual machine that runs Java programs and
can be installed on several operating systems such as Windows ,
UNIX, Macintosh etc. JVM allows Java programs to run on
almost any computer . A JVM processes instructions similar to a
physical processor . Java Source code extension is .java.
JAVA BYTECODE : The programs written in Java are compiled
into a machine language for a vitual computer called Java
Virtual Machine (JVM) The machine language for this special
Java Virtual Machine is called Java Bytecode . The Bytecode
files are generated with the “.class“ extension.
JAVA COMPILATION PROCESS : Source code written in Java
language is compiled into Java Bytecode. This bytecode is
interpreted by a Java interpreter ( is called JVM) to produce
output . This process is called Java compilation . Java byte code
interpreter is need for each different type of computer like
windows , unix and Macintosh . Java byte code interpreter can
run any Java Bytecode Program
JAVA COMPILATION PROCESS
JAVA
JAVA COMPILER BYTECODE
SOURCE CODE
WINDOWS RUNNING
JVM
BYTECODE UNIX RUNNING JVM
MACINTOSH
RUNNING JVM
THANK YOU