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

JAVA Basics

Uploaded by

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

JAVA Basics

Uploaded by

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

JAVA Basics

Topics

● Two Basic Programming Model


○ Process / Procedure Oriented Programming
○ Object Oriented Programming
● Features of Object Oriented Programming
○ Class & Objects
○ Abstraction
○ Encapsulation
○ Inheritance
○ Polymorphism
● Introduction to Java
Topics

● Features Of Java
● Java Architecture
● Editions of Java
● Running Java - First Example
Programming Models
Process Oriented Programming
● Program is written around “What is happening”.
● Focus on procedure / algorithms rather than data.
● Follows top down approach
● Program is divided into small parts called functions and then it follows a series
of defined calculational steps to perform the task.
● Communication through functions
Programming Models
Process Oriented Programming
● Used mainly for applications where data security is not a major concern.
● Example embedded system like calculator, freeze, washing machine, Car's
temperature controller etc.
● Ex. C, Fortran, Pascal, COBOL, BASIC
Programming Models
Object Oriented Programming
● Program is written around “who is being affected”.
● Focus on data security
● Functions that operate on the data of an object are tied together in the data
type.
● Program is divided into small parts called Objects.
● Communication through objects
● Ex. C++, Java, Python, Ruby, Java Script, PHP, Perl
Features Of OOP

● Objects – Instance of class which contains states and behavior.


● Class - A blueprint from which instance of class is created.
● Abstraction – Hiding complexity and showing only necessary details.
● Encapsulation – Binding of data and functions together inside class.
● Inheritance – One object acquires the properties of another object
● Polymorphism – One interface multiple methods or One interface to be used
for a general class of actions.
Introduction To Java
Java is a cross platform Object oriented programming language.
History of Java
● Developed in 1991 by James Gosling and Patric Naughton of Sun
Microsystem Inc , named as 'Oak'.
● In 1995, name changed to Java.
● In 2010, acquired by Oracle Corportation.
● Design goal of Java is “WORA (Write Once Run Anywhere”).
● First publicly available version of Java (Java 1.0) was released in 1995
● The latest version of Java is Java SE 16, released in March, 2021.
Features of Java

● Simple
● Compiled & Interpreted
● Platform Independent
● Portable
● Object Oriented
● Robust
● Secure
Features of Java

● Multithreading
● Distributed
● Dynamic
● High Performance
Features of Java
Simple
● NoEasy to learn
header and
files, use
pointers, operator overloading
Compiled & Interpreted
● Java
Somecombines
● interpreted the
language.
compiled
interpreted power ofC,
languages:
languages: compiler and
C++,Script,
Java C#, interpreter
COBOL
Perl, both.
Python, So, Java
BASIC, PHP,isRuby
both compiled and
Platform Independent / Architecture Neutral
● Assures
● Program
concept
machines compiled
of
theByte
Java
even onOS
Code. oneupgrades,
program
after machine can be
written today, runexecuted
processor tomorrow onon
upgrades any other
orthe
anysamemachine
machine
system byorusing
resourcesotherthe
changes.
(Courtesy: Google
Image)
Features of Java
Portable

● The
The size
Any sameofjava
change
application. primitive
in OS, datarunning
type or
Processor
program is on
machine
System independent.
resources
different will yields
machines not enforce
the sameany result.
changeEx.
in Applet.
Java
Object Oriented
● Java is an object
applications
Inheritance itoriented
andPolymorphism.
and language
also supports as it object
various uses classes
orientedand objects
features to Encapsulation,
like develop variousAbstraction,
Robust
The Java
● Java forceprogram executes
you to find reliably in
your mistakes a variety
early of systems.
in program development.
Features of Java

● Java
Java handles
exception properly
handling.
provides automatictwo main reasons
garbage of program
collection failure
for unused : memory management &
objects
Secure
● other
Java confines a java
parts of the program to the Java execution environment and not allowing access to
computer.
Multihthreded
● Java allows to write programs that do many things simultaneously.
Features of Java
Distributed

● Java comes
environment
creating
A Java
different with
of the
network
program
location. extensive
Internet
connection
can library
using
interact
Java for (Remote
easier.
with
supports other
RMI development
TCP/IP protocol
Program of applications
such
running
Method as
onHTTP, formachines
FTP
different
Invocation) the disributed
which makes
at anythe
Features of Java
Dynamic
● Java
time. has run-time
It is safe type
to link information
code that is used
in safe manner. toprovides
It also verify and resolvememory
dynamic access to objects at run
allocation.
High Performance
Byte
● Just codes
In Timegenerated byapplication.
JVM
(JIT)ofcompiler,
the performance Java are highly
compiles optimized,
the part so execution
of the code of byte and
as on demand codethus
is fast.
improving
Components of Java Software
Components of Java Software

● JDK
JIT ( (Java
JVM
JRE ( Java
Java
(Just Development Kit)
VirtualCompiler
Run-time
In-time Machine ))
Environment )
What is hotspot?
Block of code given to JIT compiler.
Editions Of Java
Editions of Java

● Java
basedSE
EE (( Java
Java Standard
Enterprise
applications.
Javabox.
top ME / Edition
Micro/MobileSoftware) -Edition
Edition Used ) -for
for
) - Used Used
larger for desktop environment
applications,
embedded, webwireless
mobiles applications.
services and webset
devices,
Writing and Executing a Simple Java Program
Writing and Executing a Simple Java Program
1. Create a class
2. Write main method inside class
3. Write logic
4. Compile using 'javac'
5. Execute using 'java'
Comments
1. // Single line comment
2. /* Multiple
Line
Comment */
3. /** This is for documentation **/

You might also like