Introduction To Java: by Mohini Mishra
Introduction To Java: by Mohini Mishra
Java
BY MOHINI MISHRA
What is Java?
Widespread acceptance.
How is Java different from C…
C Language:
Major difference is that C is a structure oriented language and
Java is an object oriented language and has mechanism to
define classes and objects.
Java does not support an explicit pointer type
Java does not have preprocessor, so we cant use #define,
#include and #ifdef statements.
Java does not include structures, unions and enum data types.
Java does not include keywords like goto, sizeof and typedef.
Java adds labeled break and continue statements.
Java adds many features required for object oriented
programming.
How is Java different from C++…
C++ language
Features removed in java:
Java doesn’t support pointers to avoid unauthorized
access of memory locations.
Java does not include structures, unions and enum data
types.
Java does not support operator over loading.
Preprocessor plays less important role in C++ and so
eliminated entirely in java.
Java does not perform automatic type conversions that
result in loss of precision.
Cont…
Java does not support global variables. Every method and
variable is declared within a class and forms part of that class.
Java does not allow default arguments.
Java does not support inheritance of multiple super classes by
a sub class (i.e., multiple inheritance). This is accomplished by
using ‘interface’ concept.
It is not possible to declare unsigned integers in java.
In java objects are passed by reference only. In C++ objects
may be passed by value or reference.
Cont …
source bytecode
(text) compiler (aka. class file)
dynamic
loading
verifier
virtual machine
JIT compiled
bytecode code
compiler
interpreter
CPU
Write Once, Run Anywhere
Simple Program
Run java Program
source code
(Hello.java)
compile
byte code
(Hello.class)
execute
output
Characteristics of Java
Java Is Simple
Java Is Object-Oriented
Java Is Distributed
Java Is Interpreted
Java Is Robust
Java Is Secure
Java Is Architecture-Neutral
Java Is Portable
Java's Performance
Java Is Multithreaded
Java Is Dynamic
Characteristics of Java
Java Is Simple Java is partially modeled on C++, but
greatly simplified and improved. Some
Java Is Object-Oriented people refer to Java as "C++--" because it
Java Is Distributed is like C++ but with more functionality and
fewer negative aspects.
Java Is Interpreted
Java Is Robust
Java Is Secure
Java Is Architecture-
Neutral
Java Is Portable
Java's Performance
Java Is Multithreaded
Java Is Dynamic
Characteristics of Java
Java Is Simple Java is inherently object-oriented.
Although many object-oriented
Java Is Object-Oriented languages began strictly as procedural
Java Is Distributed languages, Java was designed from
the start to be object-oriented. Object-
Java Is Interpreted oriented programming (OOP) is a
Java Is Robust popular programming approach that is
replacing traditional procedural
Java Is Secure programming techniques.
Java Is Architecture-
One of the central issues in software
Neutral development is how to reuse code.
Java Is Portable Object-oriented programming provides
great flexibility, modularity, clarity, and
Java's Performance reusability through encapsulation,
Java Is Multithreaded inheritance, and polymorphism.
Java Is Dynamic
Characteristics of Java
Java Is Simple Distributed computing involves several
computers working together on a
Java Is Object-Oriented network. Java is designed to make
Java Is Distributed distributed computing easy. Since
networking capability is inherently
Java Is Interpreted integrated into Java, writing network
Java Is Robust programs is like sending and receiving
data to and from a file.
Java Is Secure
Java Is Architecture-
Neutral
Java Is Portable
Java's Performance
Java Is Multithreaded
Java Is Dynamic
Characteristics of Java
Java Is Simple You need an interpreter to run Java
programs. The programs are compiled
Java Is Object-Oriented into the Java Virtual Machine code
Java Is Distributed called bytecode. The bytecode is
machine-independent and can run on
Java Is Interpreted any machine that has a Java
Java Is Robust interpreter, which is part of the Java
Virtual Machine (JVM).
Java Is Secure
Java Is Architecture-
Neutral
Java Is Portable
Java's Performance
Java Is Multithreaded
Java Is Dynamic
Characteristics of Java
Java Is Simple Java compilers can detect many
problems that would first show up at
Java Is Object-Oriented execution time in other languages.
Java Is Distributed
Java has eliminated certain types of
Java Is Interpreted error-prone programming constructs
Java Is Robust found in other languages.