2. Java is a popular high level, robust, object-
oriented and secure and platform
independent programming language
developed by Sun Microsystems (which is now
the subsidiary of Oracle) in the early 1990s.
Most of the java syntax has derived from
C/C++.
Sun released first JDK 1.0 in 1995.
3. Java works on different platforms (Windows, Mac,
Linux, Raspberry Pi, etc.)
Platform: Any hardware or software environment in
which a program runs, is known as a platform.
Since Java has a runtime environment (JRE) and
API(Application Programming Interface), it is called
a platform.
One of the most popular programming language in
the world and has a large demand in the current
job market
It is easy to learn, simple to use, secure, fast and
powerful
It is open-source and free
4. In 1991,James Gosling (father of Java), Patrick Naughton
and Mike Sheridan (Green Team) first invented a new
technology for convergence of digitally-controlled
consumer devices and computers named as “The Green
Project”.
Firstly, Java was called "Greentalk" by James Gosling, and
the file extension was .gt. Initially it was designed for
small, embedded systems in electronic appliances like set-
top boxes.
Gosling created a new language named “Oak” to develop
the graphics system of the controller and animated touch
screen user interface.
◦ Oak is a symbol of strength and chosen as a national tree of many
countries like the U.S.A., France, Germany, Romania, etc.
In 1995, Oak was renamed as "Java" because it was already
a trademark by Oak Technologies.
5. Desktop Applications such as acrobat reader,
media player, antivirus, etc.
Web Applications (Web servers and application
servers) such as irctc.co.in, javatpoint.com, etc.
Enterprise Applications such as banking
applications.
Mobile applications (specially Android apps).
Embedded System
Database connection
Smart Card
Robotics
Games, etc.
6. 1. Standalone Application
◦ Also known as desktop applications / window-based
applications. These are traditional software that we need to
install on every machine.
◦ Examples: Media player, antivirus, etc. AWT and Swing are
used in Java for creating standalone applications.
2. Web Application
◦ An application that runs on the server side and creates a
dynamic page is called a web application. Following
technologies are used for creating web applications in Java.
Servlet
JSP
Struts
Spring
Hibernate
JSF
7. 3. Enterprise Application
◦ An application that is distributed in nature, such as
banking applications, etc. is called an enterprise
application. It has advantages like high-level
security, load balancing, and clustering.
◦ In Java, EJB is used for creating enterprise
applications.
4. Mobile Application
◦ An application which is created for mobile devices
is called a mobile application.
◦ Currently, Android and Java ME are used for
creating mobile applications.
8. Many java versions have been released till now. The current stable release of Java
is Java SE 10.
◦ JDK Alpha and Beta (1995)
◦ JDK 1.0 (23rd Jan 1996)
◦ JDK 1.1 (19th Feb 1997)
◦ J2SE 1.2 (8th Dec 1998)
◦ J2SE 1.3 (8th May 2000)
◦ J2SE 1.4 (6th Feb 2002)
◦ J2SE 5.0 (30th Sep 2004)
◦ Java SE 6 (11th Dec 2006)
◦ Java SE 7 (28th July 2011)
◦ Java SE 8 (18th Mar 2014)
◦ Java SE 9 (21st Sep 2017)
◦ Java SE 10 (20th Mar 2018)
◦ Java SE 11 (September 2018)
◦ Java SE 12 (March 2019)
◦ Java SE 13 (September 2019)
◦ Java SE 14 (Mar 2020)
◦ Java SE 15 (September 2020)
◦ Java SE 16 (Mar 2021)
◦ Java SE 17 (September 2021)
◦ Java SE 18 (to be released by March 2022)
9. There are 4 platforms or editions of Java Technology:
Java SE (Java Standard Edition)
◦ It is a Java programming platform. It includes Java programming
APIs such as java.lang, java.io, java.net, java.util, java.sql,
java.math etc.
◦ It includes core topics like OOPs, String, Regex, Exception, Inner
classes, Multithreading, I/O Stream, Networking, AWT, Swing,
Reflection, Collection, etc.
Java EE (Java Enterprise Edition)
◦ It is an enterprise platform that is mainly used to develop web and
enterprise applications. It is built on top of the Java SE platform.
◦ It includes topics like Servlet, JSP, Web Services, EJB, JPA etc.
Java ME (Java Micro Edition)
◦ It is a micro platform that is dedicated to mobile applications.
Java FX
◦ It is used to develop rich internet applications. It uses a
lightweight user interface API.
10. We can write Java code in a text editor or in
an Integrated Development Environment,
such as IntelliJ IDEA, Netbeans or Eclipse,
11. Platform-independent C++ is platform-dependent. Java is platform-independent.
Mainly used for System programming.
Application programming. Used in Windows-
based, web-based, enterprise, and mobile
applications.
Design Goal
Designed for systems and applications
programming. It was an extension of the C
programming language.
Designed and created as an interpreter for printing
systems but later extended as a support network
computing
Goto Supports the goto statement. Doesn't support the goto statement.
Multiple inheritance Supports multiple inheritance.
Doesn't support multiple inheritance through class.
It can be achieved by using interfaces in java.
Operator Overloading Supports operator overloading. Doesn't support operator overloading.
Pointers
Supports pointers. You can write a pointer
program in C++.
Java supports pointer internally. However, you
can't write the pointer program in java.
Compiler and Interpreter
Uses compiler only. C++ is compiled and run
using the compiler which converts source code
into machine code so, C++ is platform dependent.
Uses both compiler and interpreter. Java source
code is converted into bytecode at compilation
time. The interpreter executes this bytecode at
runtime and produces output. Java is interpreted
that is why it is platform-independent.
Call by Value and Call by reference Supports both call by value and call by reference. Supports call by value not call by reference.
12. Comparison Index C++ Java
Structure and Union C++ supports structures and unions. Java doesn't support structures and unions.
Thread Support
C++ doesn't have built-in support for threads. It
relies on third-party libraries for thread support.
Java has built-in thread support.
Documentation comment C++ doesn't support documentation comments.
Java supports documentation comment (/** ... */) to
create documentation for java source code.
Virtual Keyword
C++ supports virtual keyword so that we can decide
whether or not to override a function.
Java has no virtual keyword. We can override all
non-static methods by default. In other words, non-
static methods are virtual by default.
unsigned right shift >>> C++ doesn't support >>> operator.
Java supports unsigned right shift >>> operator 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 inheritance tree.
Java always uses a single 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. However, in the
C language, a single root hierarchy is not possible.
Java is also an object-oriented language. However,
everything (except fundamental types) is an object in
Java. It is a single root hierarchy as everything gets
derived from java.lang.Object.
13. Java doesn't support default arguments like
C++.
Java does not support header files like C++.
Java uses the import keyword to include
different classes and methods.
C++ Program Example Java Program Example
File: simple.cpp
#include <iostream.h>
using namespace std;
int main() {
cout << "Hello C++ Programmi
ng";
return 0;
}
Output:
Hello C++ Programming
File: Simple.java
class Simple
{
public static void main(String a
rgs[]){
System.out.println("Hello Java"
);
}
}
Output:
Hello Java
14. To learn Java, you must have the basic knowledge
of C/C++ programming language.
For executing any Java program, the following
software or application must be properly
installed.
◦ Install the JDK if you don't have installed it, download
the JDK and install it.
◦ Set path of the jdk/bin directory.
◦ Create the Java program using text editor.
◦ Save the program file as filename.java.
◦ Compile and run the Java program
To compile: javac Simple.java
To execute: java Simple
15. class Simple
{
public static void main(String args[]){
System.out.println("Hello Java");
}
}
Output:
Hello Java
Every line of code that runs in Java must be inside a class. In
our example, we named the class Simple. A class should
always start with an uppercase first letter.
◦ Note: Java is case-sensitive: "MyClass" and "myclass" has different
meaning.
16. The name of the java file must match the
class name. When saving the file, save it
using the class name and add ".java" to the
end of the filename.
The main Method
public static void main(String[] args)
Any code inside the main() method will be
executed. Program execution starts from
main().
System.out.println()
The println() method("print line“) is used to
print a line of text or a value to the screen (or
a file).
17. Each code statement must end with a
semicolon (;).
The Print() Method
There is also a print() method, which is
similar to println().
The only difference is that it does not insert a
new line at the end of the output:
Example
System.out.print("Hello World! ");
System.out.print("I will print on the same line.");
Output:::
Hello World! I will print on the same line.