0% found this document useful (0 votes)
5 views35 pages

Overview of Java

The document provides an overview of the Java programming language, detailing its history, features, and different versions. It highlights Java's object-oriented nature, platform independence, and security features, along with the Java Virtual Machine (JVM) architecture. Additionally, it covers Java's data types, variables, and the differences between primitive and non-primitive data types.

Uploaded by

Priyanka J L
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views35 pages

Overview of Java

The document provides an overview of the Java programming language, detailing its history, features, and different versions. It highlights Java's object-oriented nature, platform independence, and security features, along with the Java Virtual Machine (JVM) architecture. Additionally, it covers Java's data types, variables, and the differences between primitive and non-primitive data types.

Uploaded by

Priyanka J L
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 35

Introduction To

JAVA

PUNITH KUMAR

RESEARCH SCHOLAR
An Overview of JAVA

 Java programming language was originally developed by Sun


Microsystems which was initiated by James Gosling and released in 1995
as core component of Sun Microsystems' Java platform (Java 1.0 [J2SE]).
 The latest release of the Java Standard Edition is Java SE 8. With the
advancement of Java and its widespread popularity, multiple
configurations were built to suit various types of platforms. For example:
J2EE for Enterprise Applications, J2ME for Mobile Applications.
 The new J2 versions were renamed as Java SE, Java EE, and Java ME
respectively. Java is guaranteed to be Write Once, Run Anywhere.
Features of JAVA
 Object Oriented − In Java, everything is an Object. Java can be easily
extended since it is based on the Object model.
 Platform Independent − Unlike many other programming languages
including C and C++, when Java is compiled, it is not compiled into platform
specific machine, rather into platform independent byte code. This byte code
is distributed over the web and interpreted by the Virtual Machine (JVM) on
whichever platform it is being run on.
 Simple − Java is designed to be easy to learn. If you understand the basic
concept of OOP Java, it would be easy to master.
 Secure − With Java's secure feature it enables to develop virus-free, tamper-
free systems. Authentication techniques are based on public-key encryption.
 Architecture-neutral − Java compiler generates an architecture-neutral
object file format, which makes the compiled code executable on many
processors, with the presence of Java runtime system.
 Dynamic − Java is considered to be more dynamic than C or C++ since it is
designed to adapt to an evolving environment. Java programs can carry
extensive amount of run-time information that can be used to verify and
resolve accesses to objects on run-time.
JAVA is
 Portable − Being architecture-neutral and having no implementation
dependent aspects of the specification makes Java portable. Compiler in Java is
written in ANSI C with a clean portability boundary, which is a POSIX subset.
 Robust − Java makes an effort to eliminate error prone situations by
emphasizing mainly on compile time error checking and runtime checking.
 Multithreaded − With Java's multithreaded feature it is possible to write
programs that can perform many tasks simultaneously. This design feature
allows the developers to construct interactive applications that can run
smoothly.
 Interpreted − Java byte code is translated on the fly to native machine
instructions and is not stored anywhere. The development process is more
rapid and analytical since the linking is an incremental and light-weight
process.
 High Performance − With the use of Just-In-Time compilers, Java enables high
performance.
 Distributed − Java is designed for the distributed environment of the internet.
History of JAVA

 Sun released the first public implementation as Java 1.0 in 1995. It


promised Write Once, Run Anywhere (WORA), providing no-cost run-
times on popular platforms.
 On 13 November, 2006, Sun released much of Java as free and open
source software under the terms of the GNU General Public License
(GPL).
 On 8 May, 2007, Sun finished the process, making all of Java's core code
free and open-source, aside from a small portion of code to which Sun
did not hold the copyright.
 The latest release of the Java Standard Edition is Java SE 21. With the
advancement of Java and its widespread popularity, multiple
configurations were built to suit various types of platforms. For example:
J2EE for Enterprise Applications, J2ME for Mobile Applications.
Java Versions History
 Over the period of nearly 30 years, Java has seen many minor and major
versions. Following is a brief explanation of versions of java till date.
Java Virtual Machine

 The JVM (Java Virtual Machine) is a virtual machine, an abstract


computer that has its own ISA, memory, stack, heap, etc. It runs on the
host OS and places its demands for resources on it.
 The JVM (Java Virtual Machine) is a specification and can have
different implementations, as long as they adhere to the specs. The
specs can be found in the below link − https://docs.oracle.com
 Oracle has its own JVM implementation (called the HotSpot JVM), the IBM
has its own (the J9 JVM, for example).
JVM (Java Virtual Machine) Architecture
 The architecture of the HotSpot JVM 3 is shown below
Difference between JDK, JRE, and JVM
OOPs (Object-Oriented Programming System)

 Object means a real-world entity such as a mobile, book, table,


computer, watch, etc.
 Object-Oriented Programming is a methodology or paradigm to design a
program using classes and objects. It simplifies software development
and maintenance by providing some concepts.
Advantages of Java OOPs

 The implementations of OOPs concepts are easier.


 The execution of the OOPs is faster than procedural-oriented
programming.
 OOPs provide code reusability so that a programmer can reuse an
existing code.
 OOPs help us to keep the important data hidden.
Difference Between Java and C++
Basic Syntax of a JAVA Program
 Let us look at a simple code that will print the words Hello World.
 About Java programs, it is very important to keep in mind the following
points.
Java Identifiers

 All Java components require names. Names used for classes, variables,
and methods are called identifiers.
 In Java, there are several points to remember about identifiers. They are
as follows −
Java Data Types

 Data types are divided into two groups:


 Primitive data types- includes byte, short, int, long, float, double,
Boolean
 Non-primitive data types - such as strings, arrays, classes.
Primitive Data Types
 A primitive data type specifies the size and type of variable values, and
it has no additional methods.
 There are eight primitive data types in Java:
Java Non-Primitive (Reference/Object)
Data Types

 The non-primitive data types are not predefined. The reference data
types are created using defined constructors of the classes.
 They are used to access objects. These variables are declared to be of a
specific type that cannot be changed. For example, Employee, Puppy,
etc.
 The following are the non-primitive (reference/object) data types −
 The default value of any reference variable is null. A reference variable
can be used to refer to any object of the declared type or any
compatible type.
 The following example demonstrates the reference (or, object) data
types.
Difference between primitive and non-
primitive data types

 Primitive types are predefined (already defined) in Java. Non-primitive


types are created by the programmer and is not defined by Java (except
for string)
 Non-primitive types can be used to call methods to perform certain
operations, while primitive types cannot.
 A primitive type always has a value, while non-primitive types can
be null.
 A primitive type starts with a lowercase letter, while non-primitive types
starts with an uppercase letter.
Java Variables

 Variables are containers for storing data values.


 Declaring (Creating) Variables: To create a variable, you must specify the
type and assign it a value:
Final Variables
 If you don't want others (or yourself) to overwrite existing values, use
the final keyword (this will declare the variable as "final" or "constant",
which means unchangeable and read-only):
Java Variables Types

 Local variables
 Instance variables
 Class/Static variables
Local variables :
 Local variables are created when the method, constructor or block is
entered and the variable will be destroyed once it exits the method,
constructor, or block.
 Access modifiers cannot be used for local variables.
 There is no default value for local variables, so local variables should be
declared and an initial value should be assigned before the first use.
Java Instance Variables

 Instance variables are declared in a class, but outside a method,


constructor or any block.
 Instance variables are created when an object is created with the use of
the keyword 'new' and destroyed when the object is destroyed.
 Access modifiers can be given for instance variables.
 Instance variables have default values. For numbers, the default value is
0, for Booleans it is false, and for object references it is null. Values can
be assigned during the declaration or within the constructor.
Example of Java Instance Variables
Java Class/Static Variables

 Class variables also known as static variables are declared with the
static keyword in a class, but outside a method, constructor or a block.
 There would only be one copy of each class variable per class,
regardless of how many objects are created from it.
 Static variables are rarely used other than being declared as constants.
Constants are variables that are declared as public/private, final, and
static. Constant variables never change from their initial value.
 Static variables are stored in the static memory. It is rare to use static
variables other than declared final and used as either public or private
constants.
 Static variables are created when the program starts and destroyed
when the program stops.
Example of Java Class/Static Variables

You might also like