Class: 11 ABC
Computer Science
Chap 4 : Introducing Java
Salient points to be discussed in this session:
1. Java Byte Code
2. JVM
3. Characteristics of Java
4. Types of Java Programs
5. Types of Program Errors
Java Byte Code :
The Java Byte Code is a machine instruction for a Java processor chip called Java Virtual
Machine. The byte code is independent of the computer system it has to run upon.
Java Virtual Machine (JVM) :
Java programs are compiled and their byte codes are produced. The byte codes are always
exactly the same irrespective of the computer system they are to execute upon. Programs are
written in Java are compiled into Java Byte Code, which is then interpreted by a special Java
Interpreter for a specific platform. Actually the java interpreter is known as Java Virtual
Machine. The machine language for the Java Virtual Machine is called Java Byte Code.
Java API :
The Java Application Programming Interface (API) are libraries of compiled code that can be
used in programs. It consists of the functions and the variables that programmers are allowed
to use in their applications.
Characteristics of Java :
Platform Independent
Java is Write Once Run Anywhere (WORA) language. This means that once the code is written
and compiled, it can be executed on any platform including Windows, Linux, Mac/OS etc.
Portable
The bytecode can be ported to any operating system.
Simple
Since its syntax resembles C and C++ programming, it is simple to learn.
Secure
Unlike C++, Java doesn’t support explicit pointers since explicit pointers were seen as a threat
to security. Implicit pointers still exist but users cannot define pointers making the language
more secure.
Robust
It has various facilities for automatic garbage collection so that the users do not have to
create destructors. It also has strong type checking and exception handling making it a robust
language.
Multithreading
Threads are independent small programs or subprograms of a program. When these threads
are run concurrently, the process is called multithreading.
Architecture Neutral
We have seen in C and C++ that the size of integers, float and other variables varies according
to the architecture of the system in bits. Java has the same size of any type of variable across
all possible architectures.
Java also performs better and can be used to create distributed applications.
Types of Java Programs :
Two types of Java Programs
1. Internet applets
2. Stand alone applications.
Internet Applets are small programs that are embedded in web pages and are run on the
viewer’s machine in a secured manner.
Stand alone application is generally a software application that does not require low level
operating or hardware access.
Types of Program Errors :
Syntax errors – due to the fact that the syntax of the language is not respected.
Semantic errors – Due to an improper use of program statements.
Logical errors – Due to the fact that the specification is not respected.
Compile time errors : Syntax errors and semantic errors indicated by the compiler.
Runtime errors : dynamic semantic errors and logical errors that cannot be detected by the
compiler.
End of the session