Java Basics 1(What is Java) [Autosaved]
Java Basics 1(What is Java) [Autosaved]
Basics
Basics
• Definition: Java is a high-level, class-
based, object-oriented programming
language.
• It is a general-purpose programming language
intended to let application developers write
once, run anywhere (WORA).
• It means that compiled Java code can run on
all platforms that support Java without the
need for recompilation
Java Basics
• Java applications are typically compiled
to bytecode that can run on any Java virtual
machine (JVM) regardless of the
underlying computer architecture.
• The syntax of Java is similar to C and C++, but
has fewer low-level facilities than either of
them.
• Java is one of the most popular programming
languages in use according to GitHub,
Java Basics
• Java was originally developed by James
Gosling at Sun Microsystems (which has since been
acquired by Oracle) and released in 1995 as a core
component of Sun Microsystems' Java platform.
• As of August 2024, the latest version is Java SE 22
released on 19th March 2024, with Java 11, a
currently supported long-term support (LTS)
version, released on September 25, 2018, will be
supported till 2026 and Java 17 will be supported till
2029. Java 8 will be supported till 2030.
Java Versions
Version Date
JDK Beta 1995
JDK1.0 January 23, 1996
JDK 1.1 February 19, 1997
J2SE 1.2 December 8, 1998
J2SE 1.3 May 8, 2000
J2SE 1.4 February 6, 2002
J2SE 5.0 September 30, 2004
Java SE 6 December 11, 2006
Java SE 7 July 28, 2011
Java SE 8 March 18, 2014
Java Versions
Versions Date
Java SE 9 September 21, 2017
Java SE 10 March 20, 2018
Java SE 11 September 25, 2018
Java SE 12 March 19, 2019
Java SE 13 September 17, 2019
Java SE 14 March 17, 2020
Java SE 15 September 15, 2020
Java SE 16 March 16, 2021
Java SE 17 September 14, 2021
Java SE 18 March 22, 2022
Java Versions
Versions Date
Java SE 19 September 20, 2022
Java SE 20 March 21, 2023
Java SE 21 September 19, 2023
Java SE 22 March 19, 2024
Java SE 23 September 2024
Java SE 24 March 2025
Java SE 25 September 2025
Java SE 26 March 2026
Java SE 27 September 2026
Java SE 28 March 2027
Java Editions
• Sun has defined and supports four editions of Java
targeting different application environments and
segmented many of its APIs so that they belong to one of
the platforms. The platforms are:
• Java Card for smart-cards.
• Java Platform, Micro Edition (Java ME) – targeting
environments with limited resources.
• Java Platform, Standard Edition (Java SE) – targeting
workstation environments.
• Java Platform, Enterprise Edition (Java EE) – targeting large
distributed enterprise or Internet environments.
Java Editions
• JavaFX
• JavaFX platform provides a modern, hardware-accelerated
graphics and media engine for developing rich desktop
applications. We can use JavaFX Script, a simple yet powerful
scripting language, to enable the development of rich online
applications, desktop applications, and GUI applications. Java
created it to replace Swing as the default GUI library.
• Below, we have mentioned the key applications of
JavaFX.
• GEONS Ground System Software (GGSS) Nasa is used in space
technology.
• NEOS (New Eurovision Operations System) is used in
television media.
• FORUM Carl Zeiss Meditec AG is used in the field of medicine.
• Quote Monitor application is used in the finance sector.
Java Packages
• The classes in the Java APIs are organized into
separate groups called packages. Each package
contains a set of related interfaces, classes,
subpackages and exceptions.
• Examples:
— basic language functionality and fundamental
java.lang
types
java.util — collection data structure classes
java.io — file operations
— Java Database Connectivity (JDBC) to access
java.sql
databases
java.rmi Provides the RMI package.
Java Programming
• class Example {
• // Your program begins with a call to main().
• public static void main(String args[]) {
• System.out.println("This is a simple Java
program.");
• }
• }
• // Save this file as Example.java
Java Programming
• Public: It is an Access modifier, which specifies
from where and who can access the method.
Making the main() method public makes it
globally available. It is made public so that
JVM can invoke it from outside the class as it is
not present in the current class.
Java Programming
• Static: It is a keyword which is when
associated with a method, makes it a class
related method. The main() method is static
so that JVM can invoke it without instantiating
the class. This also saves the unnecessary
wastage of memory which would have been
used by the object declared only for calling
the main() method by the JVM.
Java Programming
• Void: It is a keyword and used to specify that a
method doesn’t return anything.
As main() method doesn’t return anything, its
return type is void. As soon as
the main() method terminates, the java
program terminates too. Hence, it doesn’t
make any sense to return from main() method
as JVM can’t do anything with the return value
of it.
Java Programming
• main: It is the name of Java main method. It is
the identifier that the JVM looks for as the
starting point of the java program. It’s not a
keyword.
• String[] args: It stores Java command line
arguments and is an array of
type java.lang.String class. Here, the name of
the String array is args but it is not fixed and
user can use any name in place of it.
Java Programming
• The java program runs as ‘main thread’ in JVM.
The Java program is not even a process of
Operating System directly. There is no direct
interaction between Java program and Operating
System. There is no direct allocation of resources
to Java program directly, or the Java program does
not occupy any place in process table. Whom
should it return exit status to, then. Which is why
main method of Java is designed not to return int
or exit status.
Java is not a purely Object-Oriented Language
• Encapsulation/Data Hiding
• Inheritance
• Polymorphism
• Abstraction
• All predefined types are objects
• All user defined types are objects
• All operations performed on objects must be
only through methods exposed at the objects.
Java is not a purely Object-Oriented Language