SlideShare a Scribd company logo
DEPARTMENT OF COMPUTER SCIENCE
& ENGINEERING
Subject Name: Java Programming
Day: 1
Topics Covered: Introduction to Java
1
Name of the School: School of Computer Science and
Engineering
Course Code: E2UC304C Course Name:Java & Java Script
Faculty Name: Programe Name: B.Tech (CSE,AI &ML)
Prerequisites, Objectives and Outcomes
2
Prerequisite of topic: Basic concepts related to java programming
Objective: To make students aware about the different types of
exceptions along with numerous handling mechanisms available.
Outcome : 1. Student will be able to know about types of exceptions in
Java.
2. Students will be able to understand various exception handling
mechanisms.
3. Students will be able to implement in practical applications.
History of Java
3
 Java technology was created as a computer programming tool in a small, secret
effort called "the Green Project" at Sun Microsystems in 1991.
 They were trying to anticipate and plan for the "next wave" in computing. Their initial
conclusion was that at least one significant trend would be the convergence of digitally
controlled consumer devices and computers.
 A device-independent programming language code-named "Oak" was the result.
 To demonstrate how this new language could power the future of digital devices, the Green
Team developed an interactive, handheld home-entertainment device controller targeted at the
digital cable television industry. But the idea was too far ahead of its time, and the digital cable
television industry wasn't ready for the leap forward that Java technology offered them.
 In 1995, the team was able to announce that the Netscape Navigator Internet browser would
incorporate Java technology.
Object-Oriented Programming
4
 One of the most important characteristics of procedural programming is that it relies on procedures that
operate on data – these (Procedure and data) are two separate concepts.
 In object-oriented programming, these two concepts are bundled into objects.
 Object-oriented programming, or OOP, is an approach to problem-solving where all computations are
carried out using objects. An object is a component of a program that knows how to perform certain actions
and how to interact with other elements of the program.
 Objects are the basic units of object-oriented programming. A simple example of an object would be a
person. Logically, you would expect a person to have a name. This would be considered a property of the
person.
 You would also expect a person to be able to do something, such as walking. This would be considered a
method of the person.
Salient Features of Java
5
 Your Java programming language is object oriented, yet it's still dead simple.
 Your development cycle is much faster because Java technology is interpreted. The compile-
link-load-test-crash-debug cycle is obsolete--now you just compile and run.
 Your applications are portable across multiple platforms. Write your applications once, and you
never need to port them--they will run without modification on multiple operating systems and
hardware architectures.
 Your applications are robust because the Java runtime environment manages memory for you.
Salient Features of Java (Cond..)
6
 Your interactive graphical applications have high performance because
multiple concurrent threads of activity in your application are supported by
the multithreading built into the Java programming language and runtime
platform.
 Your applications are adaptable to changing environments because you can
dynamically download code modules from anywhere on the network.
 Your end users can trust that your applications are secure, even though
they're downloading code from all over the Internet; the Java runtime
environment has built-in protection against viruses and tampering.
Java Language or Platform ?
7
 Java is one of the world's most widely used computer language. Java is a simple,
general-purpose, object-oriented, interpreted, robust, secure, architecture-neutral,
portable, high-performance, multithreaded computer language.
 It is intended to let application developers "write once, run anywhere"
(WORA), meaning that code that runs on one platform does not need to be
recompiled to run on another.
 Java technology is both a programming language and a platform.
 Java is a high level, robust, secured and object-oriented programming language.
And any hardware or software environment in which a program runs, is known
as a platform.
 Since Java has its own runtime environment (JRE) and API, it is called platform.
Where Java is used?
8
 There are many devices where java is currently used. Some of them are as
follows:
 DesktopApplications
 WebApplications
 Mobile
 Embedded System
 Robotics
 Games etc
9
Getting Started with Java
Programming
Requirement of Software in Java Programming
10
 Download Free software Java Development Kit (JDK 1.5 or above)
 One Editor to write Source code
 Notepad
 Edit plus
 Java supporting IDE
JDK VERSIONS
11
 Major release versions of Java, along with their release dates:
 JDK 1.0 (January 21, 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)
JDK VERSIONS (Contd..)
JDK VERSIONS (Contd..)
12
Java SE 8 (LTS) March 2014
January 2019 for Oracle (commercial)
December 2030 for Oracle (non-commercial)
December 2030 forAzul
At least May 2026 forAdoptOpenJDK
At least May 2026 forAmazon Corretto
Java SE 9 September 2017 March 2018 for OpenJDK
Java SE 10 March 2018 September 2018 for OpenJDK
Java SE 11 (LTS) September 2018
September 2026 forAzul
At least October 2024 for AdoptOpenJDK
At least September 2027 for Amazon Corretto
At least October 2024 for Microsoft
Java SE 12 March 2019 September 2019 for OpenJDK
Java SE 13 September 2019 March 2020 for OpenJDK
Java SE 14 March 2020 September 2020 for OpenJDK
Java SE 15 September 2020
March 2021 for OpenJDK
March 2023 forAzul
Java SE 16 March 2021 September 2021 for OpenJDK
Java SE 17 (LTS) September 2021
September 2029 forAzul
At least September 2027 for Microsoft
Java SE 18 March 2022 September 2022 for OpenJDK
Installation of JDK
13
 Steps to Install & Run Java Program
 1. Download JDK
 2. Set path using environment variable
 Environment Variable:
JAVA_HOME :- path upto JDK
C:Program Files (x86)Javajdk1.8.0;
path :- path upto bin directory
C:Program Files (x86)Javajdk1.8.0bin;
 3. Open an editor -> write java code -> save file with .java extension
 4. Open command prompt -> To compile: - C>javac Abc.java
 To run > C> java Abc
Life Cycle of Java Program
14
Life Cycle of Java Program
 In the Java programming language, all source code is first written in
plain text files ending with the .java extension.
 Those source files are then compiled into .class files by the javac
compiler.
 A .class file does not contain code that is native to your processor; it
instead contains bytecodes — the machine language of the Java Virtual
Machine1 (Java VM).
 The java launcher tool then runs your application with an instance of the
Java Virtual Machine.
15
Getting Started with Java Programming
//This application program prints Welcome to Java!
public class Welcome
{
public static void main(String args[ ])
{
System.out.println("Welcome to Java!");
}
}
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
 Create one directory say AMIT in D drive
 Save this file with name “Welcome.java” in Amit directory
Creating and Compiling Programs
16
To compile: open command
prompt Go to the directory
D:Amit>
• D:Amit>
• To compile the source code
• javac Filename
• D:Amit> javac
Welcome.java
Source Code
Create/Modify Source Code
Compile Source Code
i.e. javac Welcome.java
Bytecode
Run Byteode
i.e. java Welcome
Result
If compilation errors
If runtime errors or in
correct result
17
Program Execution
 On command line
 java Filename
 D:Amit>java
Welcome
Java
Interpreter
on Windows
Java
Interpreter
on Sun Solaris
Java
Interpreter
on Linux
Bytecode
...
Program Execution
18
Execution of Java Program
 On command line
 java Filename
Java
Interpreter
on Windows
Java
Interpreter
on Sun Solaris
Java
Interpreter
on Linux
Bytecode
...
Execution of Java Program
Write & Execute Java Program
19
Open Notepad
Write java program
Compile your program
D:Amit>javacWelcome.java
Execute your class file
D:Amit>javaWelcome
output:...Welcome to Java
The Bytecode
20
 Compiled or interpreted?
 Both.
 Compiled into bytecode.
 Bytecode is in then interpreted by the java virtual machine.
 Each platform has it’s own java virtual machine on it.
 There are three ways of handing the byte code.
 There could be a byte-code interpreter.
 There could be a byte-code compiler for the machine that is it actually run on.
 There could be a java chip (which is underdevelopment).
o The bytecode is the chips actual machine language.
The Java Execution Model
21
Java source code
Java byte-code
CPU1 Native machine code
CPU2
Java chip
Byte-code
interpreter
Byte-code
compiler
Java compiler
Java virtual machine
Java virtual machine
Java machine
Platform
independent
Platform
dependent
Characteristics of Java
22
1. Java is simple
2. Java is object-oriented
3. Java is distributed
4. Java is interpreted and has high performance
5. Java is robust
6. Java is secure
7. Java is architecture-neutral
8. Java is multithreaded
9. Java is dynamic
23
 Avoid platform dependencies:You can keep your program portable by avoiding the use of libraries
written in other languages.
 Write once, run anywhere: Because applications written in the Java programming language are
compiled into machine-independent bytecodes, they run consistently on any Java platform.
 Distribute software more easily:With Java Web Start software, users will be able to launch your
applications with a single click of the mouse.
 An automatic version check at startup ensures that users are always up to date with the latest version of
your software. If an update is available, the Java Web Start software will automatically update their
installation.
24
 Get started quickly:Although the Java programming language is a powerful object-oriented
language, it's easy to learn, especially for programmers already familiar with C or C++.
 Write less code: Comparisons of program metrics (class counts, method counts, and so on)
suggest that a program written in the Java programming language can be four times smaller
than the same program written in C++.
 Write better code:The Java programming language encourages good coding practices, and
automatic garbage collection helps you avoid memory leaks. Its object orientation, its
JavaBeans™ component architecture, and its wide-ranging, easily extendible API let you reuse
existing, tested code and introduce fewer bugs.
 Develop programs more quickly:The Java programming language is simpler than C++,
and as such, your development time could be up to twice as fast when writing in it. Your
programs will also require fewer lines of code
References:
25
https://www.geeksforgeeks.org/
https://www.javatpoint.com/exception-handling-in-java
https://www.tutorialspoint.com/java/java_exceptions.htm
The complete reference, eleventh edition, available at:
https://gfgc.kar.nic.in/sirmv-science/GenericDocHandler/138-a2973dc6-c024
-4d81-be6d-5c3344f232ce.pdf
26
Thank you
Ad

More Related Content

Similar to 1_Introduction to Java.pptx java programming (20)

Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)
Pratima Parida
 
Java ms harsha
Java ms harshaJava ms harsha
Java ms harsha
Harsha Batra
 
Notes of java first unit
Notes of java first unitNotes of java first unit
Notes of java first unit
gowher172236
 
Core java slides
Core java slidesCore java slides
Core java slides
Abhilash Nair
 
JAVA ALL 5 MODULE NOTES.pptx
JAVA ALL 5 MODULE NOTES.pptxJAVA ALL 5 MODULE NOTES.pptx
JAVA ALL 5 MODULE NOTES.pptx
DrPreethiD1
 
java introduction.docx
java introduction.docxjava introduction.docx
java introduction.docx
vikasbagra9887
 
Elements of Java Language
Elements of Java Language Elements of Java Language
Elements of Java Language
Hitesh-Java
 
CORE JAVA
CORE JAVACORE JAVA
CORE JAVA
PUNE VIDYARTHI GRIHA'S COLLEGE OF ENGINEERING, NASHIK
 
Java session2
Java session2Java session2
Java session2
Jigarthacker
 
TechSearchWeb.pdf
TechSearchWeb.pdfTechSearchWeb.pdf
TechSearchWeb.pdf
TechSearchWeb
 
Technology Tutorial.pdf
Technology Tutorial.pdfTechnology Tutorial.pdf
Technology Tutorial.pdf
TechSearchWeb
 
Introduction to Java Programming, Basic Structure, variables Data type, input...
Introduction to Java Programming, Basic Structure, variables Data type, input...Introduction to Java Programming, Basic Structure, variables Data type, input...
Introduction to Java Programming, Basic Structure, variables Data type, input...
Mr. Akaash
 
Unit-IV_Introduction to Java.pdf
Unit-IV_Introduction to Java.pdfUnit-IV_Introduction to Java.pdf
Unit-IV_Introduction to Java.pdf
Assistant Professor, Shri Shivaji Science College, Amravati
 
J2ee strutswithhibernate-140121221332-phpapp01
J2ee strutswithhibernate-140121221332-phpapp01J2ee strutswithhibernate-140121221332-phpapp01
J2ee strutswithhibernate-140121221332-phpapp01
Jay Palit
 
Session 02 - Elements of Java Language
Session 02 - Elements of Java LanguageSession 02 - Elements of Java Language
Session 02 - Elements of Java Language
PawanMM
 
TechSearchWeb Tutorials.pdf
TechSearchWeb Tutorials.pdfTechSearchWeb Tutorials.pdf
TechSearchWeb Tutorials.pdf
TechSearchWeb
 
Java
JavaJava
Java
sasi saseenthiran
 
DIT 206 LECTURE 2 - Features of the Java Programming Language copy.pptx
DIT 206 LECTURE 2 - Features of the Java Programming Language copy.pptxDIT 206 LECTURE 2 - Features of the Java Programming Language copy.pptx
DIT 206 LECTURE 2 - Features of the Java Programming Language copy.pptx
kafuurismail
 
Features of java unit 1
Features of java unit 1Features of java unit 1
Features of java unit 1
RubaNagarajan
 
Java programming Evolution-OverviewOfJava.pdf
Java programming Evolution-OverviewOfJava.pdfJava programming Evolution-OverviewOfJava.pdf
Java programming Evolution-OverviewOfJava.pdf
AbhishekSingh961152
 
Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)
Pratima Parida
 
Notes of java first unit
Notes of java first unitNotes of java first unit
Notes of java first unit
gowher172236
 
JAVA ALL 5 MODULE NOTES.pptx
JAVA ALL 5 MODULE NOTES.pptxJAVA ALL 5 MODULE NOTES.pptx
JAVA ALL 5 MODULE NOTES.pptx
DrPreethiD1
 
java introduction.docx
java introduction.docxjava introduction.docx
java introduction.docx
vikasbagra9887
 
Elements of Java Language
Elements of Java Language Elements of Java Language
Elements of Java Language
Hitesh-Java
 
Technology Tutorial.pdf
Technology Tutorial.pdfTechnology Tutorial.pdf
Technology Tutorial.pdf
TechSearchWeb
 
Introduction to Java Programming, Basic Structure, variables Data type, input...
Introduction to Java Programming, Basic Structure, variables Data type, input...Introduction to Java Programming, Basic Structure, variables Data type, input...
Introduction to Java Programming, Basic Structure, variables Data type, input...
Mr. Akaash
 
J2ee strutswithhibernate-140121221332-phpapp01
J2ee strutswithhibernate-140121221332-phpapp01J2ee strutswithhibernate-140121221332-phpapp01
J2ee strutswithhibernate-140121221332-phpapp01
Jay Palit
 
Session 02 - Elements of Java Language
Session 02 - Elements of Java LanguageSession 02 - Elements of Java Language
Session 02 - Elements of Java Language
PawanMM
 
TechSearchWeb Tutorials.pdf
TechSearchWeb Tutorials.pdfTechSearchWeb Tutorials.pdf
TechSearchWeb Tutorials.pdf
TechSearchWeb
 
DIT 206 LECTURE 2 - Features of the Java Programming Language copy.pptx
DIT 206 LECTURE 2 - Features of the Java Programming Language copy.pptxDIT 206 LECTURE 2 - Features of the Java Programming Language copy.pptx
DIT 206 LECTURE 2 - Features of the Java Programming Language copy.pptx
kafuurismail
 
Features of java unit 1
Features of java unit 1Features of java unit 1
Features of java unit 1
RubaNagarajan
 
Java programming Evolution-OverviewOfJava.pdf
Java programming Evolution-OverviewOfJava.pdfJava programming Evolution-OverviewOfJava.pdf
Java programming Evolution-OverviewOfJava.pdf
AbhishekSingh961152
 

Recently uploaded (20)

YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
Sugar-Sensing Mechanism in plants....pptx
Sugar-Sensing Mechanism in plants....pptxSugar-Sensing Mechanism in plants....pptx
Sugar-Sensing Mechanism in plants....pptx
Dr. Renu Jangid
 
Engage Donors Through Powerful Storytelling.pdf
Engage Donors Through Powerful Storytelling.pdfEngage Donors Through Powerful Storytelling.pdf
Engage Donors Through Powerful Storytelling.pdf
TechSoup
 
Kenan Fellows Participants, Projects 2025-26 Cohort
Kenan Fellows Participants, Projects 2025-26 CohortKenan Fellows Participants, Projects 2025-26 Cohort
Kenan Fellows Participants, Projects 2025-26 Cohort
EducationNC
 
Metamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative JourneyMetamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative Journey
Arshad Shaikh
 
dynastic art of the Pallava dynasty south India
dynastic art of the Pallava dynasty south Indiadynastic art of the Pallava dynasty south India
dynastic art of the Pallava dynasty south India
PrachiSontakke5
 
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdfBiophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
PKLI-Institute of Nursing and Allied Health Sciences Lahore , Pakistan.
 
Exercise Physiology MCQS By DR. NASIR MUSTAFA
Exercise Physiology MCQS By DR. NASIR MUSTAFAExercise Physiology MCQS By DR. NASIR MUSTAFA
Exercise Physiology MCQS By DR. NASIR MUSTAFA
Dr. Nasir Mustafa
 
Grade 3 - English - Printable Worksheet (PDF Format)
Grade 3 - English - Printable Worksheet  (PDF Format)Grade 3 - English - Printable Worksheet  (PDF Format)
Grade 3 - English - Printable Worksheet (PDF Format)
Sritoma Majumder
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
To study the nervous system of insect.pptx
To study the nervous system of insect.pptxTo study the nervous system of insect.pptx
To study the nervous system of insect.pptx
Arshad Shaikh
 
THE STG QUIZ GROUP D.pptx quiz by Ridip Hazarika
THE STG QUIZ GROUP D.pptx   quiz by Ridip HazarikaTHE STG QUIZ GROUP D.pptx   quiz by Ridip Hazarika
THE STG QUIZ GROUP D.pptx quiz by Ridip Hazarika
Ridip Hazarika
 
GDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptxGDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptx
azeenhodekar
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
Grade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable WorksheetGrade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable Worksheet
Sritoma Majumder
 
To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
Real GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for SuccessReal GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for Success
Mark Soia
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
Introduction-to-Communication-and-Media-Studies-1736283331.pdf
Introduction-to-Communication-and-Media-Studies-1736283331.pdfIntroduction-to-Communication-and-Media-Studies-1736283331.pdf
Introduction-to-Communication-and-Media-Studies-1736283331.pdf
james5028
 
Sugar-Sensing Mechanism in plants....pptx
Sugar-Sensing Mechanism in plants....pptxSugar-Sensing Mechanism in plants....pptx
Sugar-Sensing Mechanism in plants....pptx
Dr. Renu Jangid
 
Engage Donors Through Powerful Storytelling.pdf
Engage Donors Through Powerful Storytelling.pdfEngage Donors Through Powerful Storytelling.pdf
Engage Donors Through Powerful Storytelling.pdf
TechSoup
 
Kenan Fellows Participants, Projects 2025-26 Cohort
Kenan Fellows Participants, Projects 2025-26 CohortKenan Fellows Participants, Projects 2025-26 Cohort
Kenan Fellows Participants, Projects 2025-26 Cohort
EducationNC
 
Metamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative JourneyMetamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative Journey
Arshad Shaikh
 
dynastic art of the Pallava dynasty south India
dynastic art of the Pallava dynasty south Indiadynastic art of the Pallava dynasty south India
dynastic art of the Pallava dynasty south India
PrachiSontakke5
 
Exercise Physiology MCQS By DR. NASIR MUSTAFA
Exercise Physiology MCQS By DR. NASIR MUSTAFAExercise Physiology MCQS By DR. NASIR MUSTAFA
Exercise Physiology MCQS By DR. NASIR MUSTAFA
Dr. Nasir Mustafa
 
Grade 3 - English - Printable Worksheet (PDF Format)
Grade 3 - English - Printable Worksheet  (PDF Format)Grade 3 - English - Printable Worksheet  (PDF Format)
Grade 3 - English - Printable Worksheet (PDF Format)
Sritoma Majumder
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
To study the nervous system of insect.pptx
To study the nervous system of insect.pptxTo study the nervous system of insect.pptx
To study the nervous system of insect.pptx
Arshad Shaikh
 
THE STG QUIZ GROUP D.pptx quiz by Ridip Hazarika
THE STG QUIZ GROUP D.pptx   quiz by Ridip HazarikaTHE STG QUIZ GROUP D.pptx   quiz by Ridip Hazarika
THE STG QUIZ GROUP D.pptx quiz by Ridip Hazarika
Ridip Hazarika
 
GDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptxGDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptx
azeenhodekar
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
Grade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable WorksheetGrade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable Worksheet
Sritoma Majumder
 
To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
Real GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for SuccessReal GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for Success
Mark Soia
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
Introduction-to-Communication-and-Media-Studies-1736283331.pdf
Introduction-to-Communication-and-Media-Studies-1736283331.pdfIntroduction-to-Communication-and-Media-Studies-1736283331.pdf
Introduction-to-Communication-and-Media-Studies-1736283331.pdf
james5028
 
Ad

1_Introduction to Java.pptx java programming

  • 1. DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Subject Name: Java Programming Day: 1 Topics Covered: Introduction to Java 1 Name of the School: School of Computer Science and Engineering Course Code: E2UC304C Course Name:Java & Java Script Faculty Name: Programe Name: B.Tech (CSE,AI &ML)
  • 2. Prerequisites, Objectives and Outcomes 2 Prerequisite of topic: Basic concepts related to java programming Objective: To make students aware about the different types of exceptions along with numerous handling mechanisms available. Outcome : 1. Student will be able to know about types of exceptions in Java. 2. Students will be able to understand various exception handling mechanisms. 3. Students will be able to implement in practical applications.
  • 3. History of Java 3  Java technology was created as a computer programming tool in a small, secret effort called "the Green Project" at Sun Microsystems in 1991.  They were trying to anticipate and plan for the "next wave" in computing. Their initial conclusion was that at least one significant trend would be the convergence of digitally controlled consumer devices and computers.  A device-independent programming language code-named "Oak" was the result.  To demonstrate how this new language could power the future of digital devices, the Green Team developed an interactive, handheld home-entertainment device controller targeted at the digital cable television industry. But the idea was too far ahead of its time, and the digital cable television industry wasn't ready for the leap forward that Java technology offered them.  In 1995, the team was able to announce that the Netscape Navigator Internet browser would incorporate Java technology.
  • 4. Object-Oriented Programming 4  One of the most important characteristics of procedural programming is that it relies on procedures that operate on data – these (Procedure and data) are two separate concepts.  In object-oriented programming, these two concepts are bundled into objects.  Object-oriented programming, or OOP, is an approach to problem-solving where all computations are carried out using objects. An object is a component of a program that knows how to perform certain actions and how to interact with other elements of the program.  Objects are the basic units of object-oriented programming. A simple example of an object would be a person. Logically, you would expect a person to have a name. This would be considered a property of the person.  You would also expect a person to be able to do something, such as walking. This would be considered a method of the person.
  • 5. Salient Features of Java 5  Your Java programming language is object oriented, yet it's still dead simple.  Your development cycle is much faster because Java technology is interpreted. The compile- link-load-test-crash-debug cycle is obsolete--now you just compile and run.  Your applications are portable across multiple platforms. Write your applications once, and you never need to port them--they will run without modification on multiple operating systems and hardware architectures.  Your applications are robust because the Java runtime environment manages memory for you.
  • 6. Salient Features of Java (Cond..) 6  Your interactive graphical applications have high performance because multiple concurrent threads of activity in your application are supported by the multithreading built into the Java programming language and runtime platform.  Your applications are adaptable to changing environments because you can dynamically download code modules from anywhere on the network.  Your end users can trust that your applications are secure, even though they're downloading code from all over the Internet; the Java runtime environment has built-in protection against viruses and tampering.
  • 7. Java Language or Platform ? 7  Java is one of the world's most widely used computer language. Java is a simple, general-purpose, object-oriented, interpreted, robust, secure, architecture-neutral, portable, high-performance, multithreaded computer language.  It is intended to let application developers "write once, run anywhere" (WORA), meaning that code that runs on one platform does not need to be recompiled to run on another.  Java technology is both a programming language and a platform.  Java is a high level, robust, secured and object-oriented programming language. And any hardware or software environment in which a program runs, is known as a platform.  Since Java has its own runtime environment (JRE) and API, it is called platform.
  • 8. Where Java is used? 8  There are many devices where java is currently used. Some of them are as follows:  DesktopApplications  WebApplications  Mobile  Embedded System  Robotics  Games etc
  • 9. 9 Getting Started with Java Programming
  • 10. Requirement of Software in Java Programming 10  Download Free software Java Development Kit (JDK 1.5 or above)  One Editor to write Source code  Notepad  Edit plus  Java supporting IDE
  • 11. JDK VERSIONS 11  Major release versions of Java, along with their release dates:  JDK 1.0 (January 21, 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)
  • 12. JDK VERSIONS (Contd..) JDK VERSIONS (Contd..) 12 Java SE 8 (LTS) March 2014 January 2019 for Oracle (commercial) December 2030 for Oracle (non-commercial) December 2030 forAzul At least May 2026 forAdoptOpenJDK At least May 2026 forAmazon Corretto Java SE 9 September 2017 March 2018 for OpenJDK Java SE 10 March 2018 September 2018 for OpenJDK Java SE 11 (LTS) September 2018 September 2026 forAzul At least October 2024 for AdoptOpenJDK At least September 2027 for Amazon Corretto At least October 2024 for Microsoft Java SE 12 March 2019 September 2019 for OpenJDK Java SE 13 September 2019 March 2020 for OpenJDK Java SE 14 March 2020 September 2020 for OpenJDK Java SE 15 September 2020 March 2021 for OpenJDK March 2023 forAzul Java SE 16 March 2021 September 2021 for OpenJDK Java SE 17 (LTS) September 2021 September 2029 forAzul At least September 2027 for Microsoft Java SE 18 March 2022 September 2022 for OpenJDK
  • 13. Installation of JDK 13  Steps to Install & Run Java Program  1. Download JDK  2. Set path using environment variable  Environment Variable: JAVA_HOME :- path upto JDK C:Program Files (x86)Javajdk1.8.0; path :- path upto bin directory C:Program Files (x86)Javajdk1.8.0bin;  3. Open an editor -> write java code -> save file with .java extension  4. Open command prompt -> To compile: - C>javac Abc.java  To run > C> java Abc
  • 14. Life Cycle of Java Program 14 Life Cycle of Java Program  In the Java programming language, all source code is first written in plain text files ending with the .java extension.  Those source files are then compiled into .class files by the javac compiler.  A .class file does not contain code that is native to your processor; it instead contains bytecodes — the machine language of the Java Virtual Machine1 (Java VM).  The java launcher tool then runs your application with an instance of the Java Virtual Machine.
  • 15. 15 Getting Started with Java Programming //This application program prints Welcome to Java! public class Welcome { public static void main(String args[ ]) { System.out.println("Welcome to Java!"); } } ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,  Create one directory say AMIT in D drive  Save this file with name “Welcome.java” in Amit directory
  • 16. Creating and Compiling Programs 16 To compile: open command prompt Go to the directory D:Amit> • D:Amit> • To compile the source code • javac Filename • D:Amit> javac Welcome.java Source Code Create/Modify Source Code Compile Source Code i.e. javac Welcome.java Bytecode Run Byteode i.e. java Welcome Result If compilation errors If runtime errors or in correct result
  • 17. 17 Program Execution  On command line  java Filename  D:Amit>java Welcome Java Interpreter on Windows Java Interpreter on Sun Solaris Java Interpreter on Linux Bytecode ... Program Execution
  • 18. 18 Execution of Java Program  On command line  java Filename Java Interpreter on Windows Java Interpreter on Sun Solaris Java Interpreter on Linux Bytecode ... Execution of Java Program
  • 19. Write & Execute Java Program 19 Open Notepad Write java program Compile your program D:Amit>javacWelcome.java Execute your class file D:Amit>javaWelcome output:...Welcome to Java
  • 20. The Bytecode 20  Compiled or interpreted?  Both.  Compiled into bytecode.  Bytecode is in then interpreted by the java virtual machine.  Each platform has it’s own java virtual machine on it.  There are three ways of handing the byte code.  There could be a byte-code interpreter.  There could be a byte-code compiler for the machine that is it actually run on.  There could be a java chip (which is underdevelopment). o The bytecode is the chips actual machine language.
  • 21. The Java Execution Model 21 Java source code Java byte-code CPU1 Native machine code CPU2 Java chip Byte-code interpreter Byte-code compiler Java compiler Java virtual machine Java virtual machine Java machine Platform independent Platform dependent
  • 22. Characteristics of Java 22 1. Java is simple 2. Java is object-oriented 3. Java is distributed 4. Java is interpreted and has high performance 5. Java is robust 6. Java is secure 7. Java is architecture-neutral 8. Java is multithreaded 9. Java is dynamic
  • 23. 23  Avoid platform dependencies:You can keep your program portable by avoiding the use of libraries written in other languages.  Write once, run anywhere: Because applications written in the Java programming language are compiled into machine-independent bytecodes, they run consistently on any Java platform.  Distribute software more easily:With Java Web Start software, users will be able to launch your applications with a single click of the mouse.  An automatic version check at startup ensures that users are always up to date with the latest version of your software. If an update is available, the Java Web Start software will automatically update their installation.
  • 24. 24  Get started quickly:Although the Java programming language is a powerful object-oriented language, it's easy to learn, especially for programmers already familiar with C or C++.  Write less code: Comparisons of program metrics (class counts, method counts, and so on) suggest that a program written in the Java programming language can be four times smaller than the same program written in C++.  Write better code:The Java programming language encourages good coding practices, and automatic garbage collection helps you avoid memory leaks. Its object orientation, its JavaBeans™ component architecture, and its wide-ranging, easily extendible API let you reuse existing, tested code and introduce fewer bugs.  Develop programs more quickly:The Java programming language is simpler than C++, and as such, your development time could be up to twice as fast when writing in it. Your programs will also require fewer lines of code