Computer Science - Java - C3 - Note 1
Computer Science - Java - C3 - Note 1
What is Java?
Java is a programming language and a platform. Java is a high level, robust,
object-oriented and secure programming language.
Features of Java:
The primary objective of Java programming language creation was to make it
portable, simple and secure programming language.
1. Simple: Java is very easy to learn, and its syntax is simple, clean and
easy to understand. According to Sun, Java language is a simple
programming language because:
Object
Class
Inheritance
Polymorphism
Abstraction
3. Portable: Java is portable because it facilitates you to carry the Java byte
code to any platform. It doesn't require any implementation.
4. Platform independent: Java is platform independent because it is
different from other languages like C, C++, etc. which are compiled into
platform specific machines while Java is a write once, run anywhere
language. A platform is the hardware or software environment in which a
program runs.
5. Secured: Java is best known for its security. With Java, we can develop
virus-free systems.
6. Robust: Robust simply means strong. Java is robust because:
C++ JAVA
i) C++ is platform-dependent. i) Java is platform-independent.
ii) C++ is mainly used for system programming. ii) Java is mainly used for application programming.
iii) C++ supports multiple inheritances. iii) It doesn't support multiple inheritance.
iv) C++ supports operator overloading. iv) It doesn't support operator overloading.
V) C++ supports structures and union. V) Does not support structures and unions.
class Simple{
public static void main(String args[]){
System.out.println("Hello Java");
}
}
save this file as Simple.java
o Primitive data types: The primitive data types include boolean, char,
byte, short, int, long, float and double.
o Non-primitive data types: The non-primitive data types
include Classes, Interfaces, and Arrays.
JVM
JVM is an acronym for Java Virtual Machine; it is an abstract machine which
provides the runtime environment in which Java bytecode can be executed. It is
a specification which specifies the working of Java Virtual Machine. JVMs are
available for many hardware and software platforms (so JVM is platform
dependent). It is a runtime instance which is created when we run the Java class.
JRE
JRE stands for Java Runtime Environment. It is the implementation of JVM.
The Java Runtime Environment is a set of software tools which are used for
developing Java applications. It is used to provide the runtime environment. It
physically exists.
JDK
JDK is an acronym for Java Development Kit. It is a software development
environment which is used to develop Java applications and applets. It
physically exists. It contains JRE + development tools.
o Fields
o Methods
o Constructors
o Blocks
o Nested class and interface
o By new keyword
o By new Instance() method
o By clone() method
o By factory method etc.
Subhajit Dey
Guest Lecturer
Sonamukhi College