Java and DS - Chapter 1
Java and DS - Chapter 1
be transmitted over the internet and executed by the web browser that is Java-
compatible. Applets are the small program that is used to display data provided by the
server, handle user input, provide a simple function such as calculator etc.
Java solves the Security and the portability issue of the other language that is being
used. The key that allows doing so is the Bytecode. Bytecode is a highly optimized set
of instruction that is designed to be executed by the Java Virtual Machine (JVM). Java
programs are executed by the JVM also helps to make Java a secure programming g
language because the JVM contains the application and prevents it from affecting the
external systems.
Java can be used to construct two kinds of programs: Applications and Applets.
An Application is a program that runs on our computer, under the operating system of
that computer. That is, an application created by Java is more or less like one created
using C or C++. When used to create applications, Java is not much different from any
other computer language.
1.4 The History and Evolution of Java
In C programming, int data type occupies 2 bytes of memory for 32-bit architecture
and 4 bytes of memory for 64-bit architecture. However, it occupies 4 bytes of
memory for both 32 and 64-bit architectures in Java.
8. Interpreted
Java is an interpreted language.
Java programs can be executed directly on any machine, which has the Java interpreter
known as the Java Virtual Machine and where the run-time environment has been
ported.
9. High Performance
Java provides high performance with the use of “JIT – Just In Time compiler”, in
which the compiler compiles the code on-demand basis, that is, it compiles only that
method which is being called. This saves time and makes it more efficient.
Bytecodes generated by the Java compiler are highly optimized, so Java Virtual
Machine can execute them much faster.
10. Distributed
Java is distributed because it encourages users to create distributed applications.
RMI (Remote Method Invocation) and EJB (Enterprise Java Beans) are used for
creating distributed applications.
This enables multiple programmers at multiple remote locations to collaborate and
work together on a single project.
11. Dynamic
Java programs are dynamic.
A Java program consists of many modules and when they undergo any changes, the
dynamism of Java avoids problems caused by change of code used in a program.
1.6 Java and C++
Java is a true object-oriented language while C++ is basically C with object-oriented
extension.
Some major C++ features that were intentionally omitted from Java or significantly
modified are:
Java does not support Operator Overloading.
Java and Data Structures 1.7
Exercises:
1. What is Java?
2. Write short notes on History of Java.
3. Discuss briefly about the Evolution of Java.
4. What do you mean by Java ―Applets‖ and ―Applications‖?
5. Explain the Features of Java.
6. Distinguish between Java and C++.
7. Write short notes on Java and Internet.
8. Write a brief note on Java and WWW.
****************************