SlideShare a Scribd company logo
Java/J2EE Programming Training
Introduction to Java
Page 2Classification: Restricted
Agenda
• Understand the advantages of Java
• Understand where Java is used
• Understand how memory management is handled in Java
• Create a Java project in Eclipse and execute it
• Implement if..else construct in Java
• Develop codes using various data types in Java
• Implement various loops
Page 3Classification: Restricted
Meet John
• Mike is a student of Computer Science in
California University.
Page 4Classification: Restricted
John learns about Programming Languages
Page 5Classification: Restricted
John is Confused
Page 6Classification: Restricted
John gets a Bookish Answer
Page 7Classification: Restricted
John is Still Confused
Page 8Classification: Restricted
John heads home with a doub’t
Page 9Classification: Restricted
John meets his Brother
Page 10Classification: Restricted
John expresses his concerns
Page 11Classification: Restricted
John gets an Answer!
Page 12Classification: Restricted
John wants to know more..
Page 13Classification: Restricted
John gets help!
Page 14Classification: Restricted
Use of Java-1
Page 15Classification: Restricted
Use of Java - 2
Page 16Classification: Restricted
Use of Java - 3
1
6
Page 17Classification: Restricted
John is convinced to learn Java
1
7
Page 18Classification: Restricted
A Gift for John
1
8
Page 19Classification: Restricted
An Android Phone
1
9
Page 20Classification: Restricted
John is all set to learn Java
2
0
Page 21Classification: Restricted
What is Java?
• Java is a computer programming language that is
• Concurrent
• class-based
• object-oriented
• specifically designed to have as few implementation dependencies as
possible.
2
1
Page 22Classification: Restricted
Where is Java Used?
• Java is used in various enterprise level application/frameworks all around the
world.
• Java is used:
– In over 850 million PCs as Java Runtime Environment
– To develop Android Applications
– To develop Hadoop Applications
– To develop business process management(BPM) tools.
– To develop webservers,application servers, etc.
• Java has been used to develop below frameworks:
– Hadoop
– Spring
– Hibernate
– Struts
2
2
Page 23Classification: Restricted
Java –Job, Demand and Experience Trends
2
3
Page 24Classification: Restricted
Languages before Java
• Before Java emerged as a programming language, there were many other
programming languages:
– C
– C++ (the dominant player in the trade)
– Visual Basics
– Python
• The primary goal was to replace C++:
– C++ does not provide efficient means for garbage collection
– No built in support for threads
– It gets complex when u want to develop a graphics richapplication
– C++ is not platform independent
– In C++ memory allocation and de-allocation has to be done by the
developer
2
4
Page 25Classification: Restricted
History of Java
• Java was developed by James
Gosling in Sun Microsystems.
• It is a platform independent
programming language.
• This language was initially
named as OAK and later
renamed as JAVA.
2
5
Page 26Classification: Restricted
JavaVersions
2
6
Features of Java
2
7
Page 28Classification: Restricted
Features of JAVA
Page 29Classification: Restricted
C++ : Platform Dependent
2
9
Page 30Classification: Restricted
Java : Platform Independent
3
0
Page 31Classification: Restricted
Features of Java
3
1
Page 32Classification: Restricted
Features of JAVA
3
2
Page 33Classification: Restricted
Features of JAVA
3
3
Page 34Classification: Restricted
Features of JAVA
3
4
Page 35Classification: Restricted
Features of JAVA
3
5
Page 36Classification: Restricted
Features of JAVA
3
6
Page 37Classification: Restricted
Features of JAVA
3
Page 38Classification: Restricted
Features of JAVA
3
8
Page 39Classification: Restricted
Features of Java
3
9
Page 40Classification: Restricted
Questions
4
0
What is byte code?
Page 41Classification: Restricted
Answer
4
1
Bytecode is an intermediate code which gets generated when a Java file is
compiled using a Javac compiler. After compilation .class file is generated
which contains the byte code. This code is platform independent.
Page 42Classification: Restricted
Question
4
2
What is the advantage of executing parallel
threads/tasks at a time?
Page 43Classification: Restricted
Answer
4
3
When many tasks/threads run at the same time, performance of the system
increases.
Page 44Classification: Restricted
Bytecode and Java Virtual Machine (JVM)
• Java bytecode is the form of instructions that the Java Virtual Machine
executes.
• AJavaprogrammer need not understand bytecode at all.
• Java Virtual Machine (JVM)
– Runs the bytecode
– Makes Java platform independent
– Handles memory management
4
4
Page 45Classification: Restricted
Java Memory Management
• C/C++ has pointers. User can
allocate memory to these
pointers.
• If the pointer is accessed
without allocating memory or
invalid pointer is accessed then
program crashes.
• These issues are removed from
Java as Java does not have
pointers. Complete memory
management ishandled by Java
itself.
4
5
Page 46Classification: Restricted
Heap and Garbage Collector
• The memory area in JVM where objects are created is called Heap.
• Heap is divided into two parts. Young space and old space.
• The memory is freed during runtime by a special thread called Garbage
Collector.
• The Garbage Collector looks for objects which are no longer needed by
the program and destroysthem.
• All the newly allocated objects are created in young space. Once the
young space is full then garbage collector is called so that memory can
be released.
• If the object has lived for long in young space then they will be moved to
old space. Once the old space is full, garbage collector is called to
release the space in heap.
4
6
Page 47Classification: Restricted
Heap In side JVM
4
7
Page 48Classification: Restricted
Inside Heap
4
8
Page 49Classification: Restricted
Objects and References
4
9
Page 50Classification: Restricted
Garbage Collector
5
0
Page 51Classification: Restricted
How Java Works?
5
1
Page 52Classification: Restricted
Data Types
5
2
Page 53Classification: Restricted
Question
5
3
Why do you think we need byte, short and long datatypes when
int can be used?
Page 54Classification: Restricted
Answer
5
4
‘byte’ takes 1 byte, ‘short’ takes 2 bytes and ‘int’ takes 4 bytes in
memory. If we know that the variable need not be very big then
‘short’ is fine as it reduces the memory consumption which inturn
increases the performance of the project.
Page 55Classification: Restricted
Data Operations
5
5
Page 56Classification: Restricted
Required Software
• Required software for Java Programming
– »JDK 1.7 64 bit or 32 bit according to your machine.
• http://www.oracle.com/technetwork/java/javase/downloads/jd
k7-downloads-1880260.html
5
6
Page 57Classification: Restricted
Required Software
• Required software for Java Programming
– Eclipse J2EE version for 64 bit or 32 bit
according to your machine.
• https://www.eclipse.org/downloads/
5
7
Page 58Classification: Restricted
Select a workspace
5
Page 59Classification: Restricted
Create a Project
5
9
Page 60Classification: Restricted
Create Class
6
Page 61Classification: Restricted
My First Program
6
1
Page 62Classification: Restricted
Execute Java Program
6
2
Page 63Classification: Restricted
Main Method
6
3
Page 64Classification: Restricted
Programs for Data Types and Operations
6
4
Page 65Classification: Restricted
Choices in Real Life
6
5
Page 66Classification: Restricted
If..else Condition
6
6
Page 67Classification: Restricted
‘if’ Conditions
6
7
Page 68Classification: Restricted
If..else in Java
6
8
Page 69Classification: Restricted
if else in Java (Contd..)
6
9
Page 70Classification: Restricted
Program on if condition
7
0
Page 71Classification: Restricted
Repetitive task in Real Life
7
1
Page 72Classification: Restricted
Repetitive Tasks in Real life (contd..)
7
2
Page 73Classification: Restricted
Loops
7
Page 74Classification: Restricted
Question
7
4
What could be the advantage of using loops?
Page 75Classification: Restricted
Answer
7
5
The advantage of using loops is that, we can reduce code
repetition by placing the statements to be repeated within a loop.
As a result developer's effort will be very less.
Page 76Classification: Restricted
for…Loop
7
6
Page 77Classification: Restricted
for…Loop Program
7
7
Page 78Classification: Restricted
while… Loop
7
8
Page 79Classification: Restricted
while…Loop Program
7
9
Page 80Classification: Restricted
do…while Loop
8
Page 81Classification: Restricted
while ..Loop Program
8
1
Page 82Classification: Restricted
Assignment – Data Type and Operation
8
2
Page 83Classification: Restricted
Assignment if..Condition
8
3
Page 84Classification: Restricted
Assignment for…Loop
8
4
Page 85Classification: Restricted
Assignment – while…loop
8
5
Page 86Classification: Restricted
Assignment do..while Loop
8
6
Page 87Classification: Restricted
Pre-work
8
7
Page 88Classification: Restricted
Thank You

More Related Content

PPTX
Introduction to Java Part-2
PPTX
Java Presentation
PDF
Top 10 Dying Programming Languages in 2020 | Edureka
PPSX
Introduction to Java
PDF
History of Java 2/2
PDF
History of Java 1/2
PDF
History of java
PDF
From java-to-ruby-book-summary
Introduction to Java Part-2
Java Presentation
Top 10 Dying Programming Languages in 2020 | Edureka
Introduction to Java
History of Java 2/2
History of Java 1/2
History of java
From java-to-ruby-book-summary

What's hot (18)

ODP
The Evolution of Java
PDF
Java introduction
KEY
Polyglot and functional (Devoxx Nov/2011)
ODP
3978 Why is Java so different... A Session for Cobol/PLI/Assembler Developers
KEY
Modern Java Concurrency (OSCON 2012)
KEY
Polyglot and Functional Programming (OSCON 2012)
PPTX
Session 02 - Elements of Java Language
PPTX
Session 01 - Introduction to Java
KEY
Zend Code in ZF 2.0
PPTX
JAVA INTRODUCTION - 1
PPT
Apache Harmony: An Open Innovation
PDF
Introduction To NetBeans IDE
PPT
A begineers guide of JAVA - Getting Started
PPTX
Java Introduction
PDF
A Java Implementer's Guide to Better Apache Spark Performance
PDF
Eclipse OMR: a modern toolkit for building language runtimes
PDF
The Java Virtual Machine is Over - The Polyglot VM is here - Marcus Lagergren...
PPTX
Java introduction
The Evolution of Java
Java introduction
Polyglot and functional (Devoxx Nov/2011)
3978 Why is Java so different... A Session for Cobol/PLI/Assembler Developers
Modern Java Concurrency (OSCON 2012)
Polyglot and Functional Programming (OSCON 2012)
Session 02 - Elements of Java Language
Session 01 - Introduction to Java
Zend Code in ZF 2.0
JAVA INTRODUCTION - 1
Apache Harmony: An Open Innovation
Introduction To NetBeans IDE
A begineers guide of JAVA - Getting Started
Java Introduction
A Java Implementer's Guide to Better Apache Spark Performance
Eclipse OMR: a modern toolkit for building language runtimes
The Java Virtual Machine is Over - The Polyglot VM is here - Marcus Lagergren...
Java introduction
Ad

Similar to Introduction to Java (20)

PPTX
Object Oriented Programming Part 1 of Unit 1
PPTX
java basics concepts and the keywords needed
PPTX
Chapter-1 Introduction.pptx
PPT
The Evolution of Java
PPTX
Java Basics
PPTX
1 Module 1 Introduction.pptx
PDF
Lecture-01 _Java Introduction CS 441 Fast
PDF
JavaOne summary
PPTX
Features of JAVA Programming Language.
PDF
Tips For Maintaining OSS Projects
PDF
Java and Container - Make it Awesome !
PPT
Java ppt-class_Introduction_class_Objects.ppt
PPTX
Introduction to Java
PPTX
Introduction to Java
PPTX
CNCF Live Webinar: Low Footprint Java Containers with GraalVM
PPTX
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
PPT
Java ppt-class_basic data types methods definitions
PDF
Java for XPages Development
PDF
PDF
itft-Java evolution
Object Oriented Programming Part 1 of Unit 1
java basics concepts and the keywords needed
Chapter-1 Introduction.pptx
The Evolution of Java
Java Basics
1 Module 1 Introduction.pptx
Lecture-01 _Java Introduction CS 441 Fast
JavaOne summary
Features of JAVA Programming Language.
Tips For Maintaining OSS Projects
Java and Container - Make it Awesome !
Java ppt-class_Introduction_class_Objects.ppt
Introduction to Java
Introduction to Java
CNCF Live Webinar: Low Footprint Java Containers with GraalVM
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Java ppt-class_basic data types methods definitions
Java for XPages Development
itft-Java evolution
Ad

More from RatnaJava (13)

PPTX
Review Session and Attending Java Interviews
PPTX
Collections - Lists & sets
PPTX
Collections - Sorting, Comparing Basics
PPTX
Collections Array list
PPTX
Object Class
PPTX
Exception Handling
PPTX
OOPs with Java - Packaging and Access Modifiers
PPTX
OOP with Java - Abstract Classes and Interfaces
PPTX
OOP with Java - Part 3
PPTX
OOP with Java - continued
PPTX
Object Oriented Programming
PPTX
Data Handling and Function
PPTX
Introduction to Java Part-3
Review Session and Attending Java Interviews
Collections - Lists & sets
Collections - Sorting, Comparing Basics
Collections Array list
Object Class
Exception Handling
OOPs with Java - Packaging and Access Modifiers
OOP with Java - Abstract Classes and Interfaces
OOP with Java - Part 3
OOP with Java - continued
Object Oriented Programming
Data Handling and Function
Introduction to Java Part-3

Recently uploaded (20)

PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Approach and Philosophy of On baking technology
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
KodekX | Application Modernization Development
PDF
Electronic commerce courselecture one. Pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Empathic Computing: Creating Shared Understanding
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Cloud computing and distributed systems.
PDF
Review of recent advances in non-invasive hemoglobin estimation
Chapter 3 Spatial Domain Image Processing.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Diabetes mellitus diagnosis method based random forest with bat algorithm
The Rise and Fall of 3GPP – Time for a Sabbatical?
Approach and Philosophy of On baking technology
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Unlocking AI with Model Context Protocol (MCP)
KodekX | Application Modernization Development
Electronic commerce courselecture one. Pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
Per capita expenditure prediction using model stacking based on satellite ima...
Empathic Computing: Creating Shared Understanding
Mobile App Security Testing_ A Comprehensive Guide.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Cloud computing and distributed systems.
Review of recent advances in non-invasive hemoglobin estimation

Introduction to Java