0% found this document useful (0 votes)
19 views

JAVA Fundamental

Java is a high-level, object-oriented programming language developed in 1991, known for its platform independence and security features. It has three main editions: Standard, Enterprise, and Micro, catering to different application needs, and supports various application types including standalone, web, and mobile. Key concepts of Java include OOP principles such as encapsulation, inheritance, and polymorphism, as well as the distinction between JDK, JRE, and JVM for development and execution environments.

Uploaded by

gopogo56
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

JAVA Fundamental

Java is a high-level, object-oriented programming language developed in 1991, known for its platform independence and security features. It has three main editions: Standard, Enterprise, and Micro, catering to different application needs, and supports various application types including standalone, web, and mobile. Key concepts of Java include OOP principles such as encapsulation, inheritance, and polymorphism, as well as the distinction between JDK, JRE, and JVM for development and execution environments.

Uploaded by

gopogo56
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

JAVA

What is Java?

Java is a high-level, general-purpose, object-oriented, and secure programming language developed by James Gosling at Sun
Microsystems, Inc. in 1991. It is formally known as OAK. In 1995, Sun Microsystem changed the name to Java. In 2009, Sun
Microsystem takeover by Oracle Corporation.

Editions of Java

Each edition of Java has different capabilities. There are three editions of Java:

o Java Standard Editions (JSE): It is used to create programs for a desktop computer.
o Java Enterprise Edition (JEE): It is used to create large programs that run on the server and manages heavy traffic and
complex transactions.
o Java Micro Edition (JME): It is used to develop applications for small devices such as set-top boxes, phone, and
appliances.

Types of Java Applications

There are four types of Java applications that can be created using Java programming:

o Standalone Applications: Java standalone applications uses GUI components such as AWT, Swing, and JavaFX. These

components contain buttons, list, menu, scroll panel, etc. It is also known as desktop alienations.

o Enterprise Applications: An application which is distributed in nature is called enterprise applications.

o Web Applications: An applications that run on the server is called web applications. We use JSP, Servlet, Spring, and

Hibernate technologies for creating web applications.

o Mobile Applications: Java ME is a cross-platform to develop mobile applications which run across smartphones. Java is

a platform for App Development in Android.

Java Platform

Java Platform is a collection of programs. It helps to develop and run a program written in the Java programming language. Java
Platform includes an execution engine, a compiler and set of libraries. Java is a platform-independent language.

Features of Java

o Simple: Java is a simple language because its syntax is simple, clean, and easy to understand. Complex and ambiguous

concepts of C++ are either eliminated or re-implemented in Java. For example, pointer and operator overloading are not

used in Java.

o Object-Oriented: In Java, everything is in the form of the object. It means it has some data and behavior. A program must

have at least one class and object.

o Robust: Java makes an effort to check error at run time and compile time. It uses a strong memory management system

called garbage collector. Exception handling and garbage collection features make it strong.

o Secure: Java is a secure programming language because it has no explicit pointer and programs runs in the virtual

machine. Java contains a security manager that defines the access of Java classes.

o Platform-Independent: Java provides a guarantee that code writes once and run anywhere. This byte code is platform-

independent and can be run on any machine.


o Portable: Java Byte code can be carried to any platform. No implementation-dependent features. Everything related to

storage is predefined, for example, the size of primitive data types.

o High Performance: Java is an interpreted language. Java enables high performance with the use of the Just-In-Time

compiler.

o Distributed: Java also has networking facilities. It is designed for the distributed environment of the internet because it

supports TCP/IP protocol. It can run over the internet. EJB and RMI are used to create a distributed system.

o Multi-threaded: Java also supports multi-threading. It means to handle more than one job a time.

OOPs (Object Oriented Programming System)

Object-oriented programming is a way of solving a complex problem by breaking them into a small sub-problem. An object is a real-
world entity. It is easier to develop a program by using an object. In OOPs, we create programs using class and object in a
structured manner.

Class: A class is a template or blueprint or prototype that defines data members and methods of an object. An object is the
instance of the class. We can define a class by using the class keyword.

Object: An object is a real-world entity that can be identified distinctly. For example, a desk, a circle can be considered as objects.
An object has a unique behavior, identity, and state. Data fields with their current values represent the state of an object (also
known as its properties or attributes).

Abstraction: An abstraction is a method of hiding irrelevant information from the user. For example, the driver only knows how to
drive a car; there is no need to know how does the car run. We can make a class abstract by using the keyword abstract. In Java,
we use abstract class and interface to achieve abstraction.

Encapsulation: An encapsulation is the process of binding data and functions into a single unit. A class is an example of
encapsulation. In Java, Java bean is a fully encapsulated class.

Inheritance: Inheritance is the mechanism in which one class acquire all the features of another class. We can achieve inheritance
by using the extends keyword. It facilitates the reusability of the code.

Polymorphism: The polymorphism is the ability to appear in many forms. In other words, single action in different ways. For
example, a boy in the classroom behaves like a student, in house behaves like a son. There are two types of polymorphism: run
time polymorphism and compile-time polymorphism.

Difference between JDK, JRE, and JVM

JVM

JVM (Java Virtual Machine) is an abstract machine. It is called a virtual machine because it doesn't physically exist. It is a
specification that provides a runtime environment in which Java byte code can be executed. It can also run those programs which
are written in other languages and compiled to Java byte code.

JVMs are available for many hardware and software platforms. JVM, JRE, and JDK are platform dependent because the
configuration of each OS is different from each other. However, Java is platform independent. There are three notions of the
JVM: specification, implementation, and instance.

The JVM performs the following main tasks:

o Loads code
o Verifies code

o Executes code

o Provides runtime environment

JRE

JRE is an acronym for Java Runtime Environment. It is also written as Java RTE. 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 is the
implementation of JVM. It physically exists. It contains a set of libraries + other files that JVM uses at runtime.

JDK

JDK is an acronym for Java Development Kit. The Java Development Kit (JDK) is a software development environment which is
used to develop Java applications and applets. It physically exists. It contains JRE + development tools.

JDK is an implementation of any one of the below given Java Platforms released by Oracle Corporation:

o Standard Edition Java Platform

o Enterprise Edition Java Platform

o Micro Edition Java Platform

The JDK contains a private Java Virtual Machine (JVM) and a few other resources such as an interpreter/loader (java), a compiler
(javac), an archiver (jar), a documentation generator (Javadoc), etc. to complete the development of a Java Application.

Gedit filename.java

javac filename.java
java filename

C++ vs Java
There are many differences and similarities between the C++ programming language and Java. A
list of top differences between C++ and Java are given below:

Comparison C++ Java


Index

Platform- C++ is platform-dependent. Java is platform-independent.


independent

Mainly used for C++ is mainly used for system Java is mainly used for application programming.
programming. It is widely used in Windows-based, web-based,
enterprise, and mobile applications.

Design Goal C++ was designed for systems and Java was designed and created as an interpreter
applications programming. It was an for printing systems but later extended as a
extension of the C programming support network computing. It was designed to
language. be easy to use and accessible to a broader
audience.

Goto C++ supports the goto statement. Java doesn't support the goto statement.

Multiple C++ supports multiple inheritance. Java doesn't support multiple inheritance through
inheritance class. It can be achieved by using interfaces in
java.

Operator C++ supports operator overloading. Java doesn't support operator overloading.
Overloading

Pointers C++ supports pointers. You can write Java supports pointer internally. However, you
a pointer program in C++. can't write the pointer program in java. It means
java has restricted pointer support in java.

Compiler and C++ uses compiler only. C++ is Java uses both compiler and interpreter. Java
Interpreter compiled and run using the compiler source code is converted into bytecode at
which converts source code into compilation time. The interpreter executes this
machine code so, C++ is platform bytecode at runtime and produces output. Java is
dependent. interpreted that is why it is platform-independent.

Call by Value and C++ supports both call by value and Java supports call by value only. There is no call
Call by reference call by reference. by reference in java.

Structure and C++ supports structures and unions. Java doesn't support structures and unions.
Union

Thread Support C++ doesn't have built-in support for Java has built-in thread support.
threads. It relies on third-party
libraries for thread support.
Documentation C++ doesn't support documentation Java supports documentation comment (/** ... */)
comment comments. to create documentation for java source code.

Virtual Keyword C++ supports virtual keyword so that Java has no virtual keyword. We can override all
we can decide whether or not to non-static methods by default. In other words,
override a function. non-static methods are virtual by default.

unsigned right C++ doesn't support >>> operator. Java supports unsigned right shift >>> operator
shift >>> that fills zero at the top for the negative numbers.
For positive numbers, it works same like >>
operator.

Inheritance Tree C++ always creates a new Java always uses a single inheritance tree
inheritance tree. because all classes are the child of the Object
class in Java. The Object class is the root of
the inheritance tree in java.

Hardware C++ is nearer to hardware. Java is not so interactive with hardware.

Object-oriented C++ is an object-oriented language. Java is also an object-oriented language.


However, in the C language, a single However, everything (except fundamental types)
root hierarchy is not possible. is an object in Java. It is a single root hierarchy
as everything gets derived from java.lang.Object.

File: main.cpp
1. #include <iostream>
2. int main() {
3. cout << "Hello C++ Programming";
4. return 0;
5. }

File: Simple.java

1. class Simple{
2. public static void main(String args[]){
3. System.out.println("Hello Java");
4. }
5. }

You might also like