SlideShare une entreprise Scribd logo
1  sur  20
Télécharger pour lire hors ligne
ObjectObject--Oriented ProgrammingOriented Programming
Lecture 4
Naveen Kumar
ObjectObject
An object is anything that can be represented by
data in a computer’s memory and manipulated by
a computer program.
Numbers, texts, pictures, sound, video ….. So on
ObjectObject
An object can be something in the physical world or even just an abstract idea.
for example: An airplane, is a physical
object that can be manipulated by a
computer.
ObjectObject
A bank transaction is an example of an object that is not physical.
To a computer,
an object is simply something that can be represented by data in the
computer’s memory and manipulated by computer programs
ObjectObject
The data that represent the
object are organized into a
set of properties.
NameName:: AI 379AI 379
OwnerOwner:: Indian AirlinesIndian Airlines
LocationLocation:: 39 52′ 06″N39 52′ 06″N 75 13′ 52″W75 13′ 52″W
HeadingHeading:: 271271°°
AltitudeAltitude:: 19 m19 m
AirSpeedAirSpeed:: 00
MakeMake:: BoeingBoeing
ModelModel:: 737737
WeightWeight:: 32,820 kg32,820 kg
The values stored in an
object’s properties, at any
one time, form the state
of an object.
ObjectObject--Oriented ProgrammingOriented Programming
Computer programs
implement algorithms that
manipulate the data.
In object-oriented
programming, the programs
that manipulate the
properties of an object are
the object’s methods.
ObjectObject--Oriented ProgrammingOriented Programming
We can think of an object
as a collection of properties
and, the methods that are
used to manipulate those
properties.
Properties
Methods
ObjectObject--Oriented ProgrammingOriented Programming
A class is a group of
objects with the same
properties and the same
methods.
ObjectObject--Oriented ProgrammingOriented Programming
Each copy of an object, from a particular
class is called an instance, of the object.
The act of creating a new instance of an object is
called instantiation.
ObjectObject--Oriented ProgrammingOriented Programming
A class can be thought of as a blueprint for
instances of its object.
Two different instances of the same class will
have the same properties, but different values
stored in those properties.
ObjectObject--Oriented ProgrammingOriented Programming
The same terminology
is used in most object-
oriented programming
languages.
Object
Instance
Property
Method
Instantiation
Class
State
Introduction to Java
12
 Development tools-part of java development kit (JDK)
 Classes and methods-part of Java Standard Library (JSL),
also known as Application Programming Interface (API)
1. JDK:
 Appletviewer ( for viewing applets)
 Javac (Compiler)
 Java (Interpreter)
 Javah (for C header files)
 Javadoc ( for creating HTML description)
Java Environment
2. Application Package Interface (API)
Contains hundreds of classes and methods grouped into several
functional packages:
 Language Support Package (String, Integer, Double, etc)
 Utility Packages (rand. num. gen., sys. date)
 Input/Output Packages
 Networking Packages (implementing networking appl. )
 AWT Package (classes for painting graphics and images)
 Applet Package (web page using java)
Java Environment
1. Java 1.0 (96)
2. Java 1.1 (97)(Add new library, redefine applet handling and
reconfigured many features.)
3. Java 2 (98)(Second generation). Version no:1.2 (Internal
version number of java library). Also known as J2SE [ Java
2 Platform Standard Edition].
- Add swing, the collection framework, enhanced JVM etc.
4. J2SE 1.3 (2000)
5. J2SE 1.4 (2002)
6. J2SE 1.5 (2004)
7. J2SE 1.6 (2006) [1.7-(2013), in queue 1.8 (exp in 2014) ]
The Evolution of Java
Comments
In Java, comments are preceded by two slashes (//) in a
line, or
enclosed between /* and */ in one or multiple lines
When the compiler sees //, it ignores all text after // in the
same line
When it sees /*, it scans for the next */ and ignores any text
between /* and */
Example
/* Traditional "Hello World!" program. */
// package pack1;
// import java.lang.System;
class A
{
public static void main (String args[])
{
System.out.println("Hello World!");
}
}
Save program as A.java
Java Program Structure
Package Statement
 Javac command compiles the source code A.java then,
generates A.class and store it under a directory which is
called as name of the package
 package statement if used must be the first statement in
a compilation unit. Its syntax is:
package packageName;
 For example:
package pack1;
Import Statement
 The import statements are similar to #include
statements in C and C++
 In the above program, System class of java.lang package
is imported into all Java programs by default. The
syntax of import statement is as:
import fullClassName;
 For example, the following import statement imports the
System class from java.lang:
import java.lang.System;
import java.lang.*;
Classes and Methods
 Class declarations contain a keyword class and an identifier (Ex: A)
 Class members are enclosed within braces. The syntax of defining a
class is shown below:
class A
{
// program code
}
 To execute a class, it must contain a valid main method
 It is the first method that automatically gets invoked when the program
executed
public static void main (String args[])
{
//instructions
}

Contenu connexe

Tendances

Java Presentation For Syntax
Java Presentation For SyntaxJava Presentation For Syntax
Java Presentation For SyntaxPravinYalameli
 
java training in jaipur|java training|core java training|java training compa...
 java training in jaipur|java training|core java training|java training compa... java training in jaipur|java training|core java training|java training compa...
java training in jaipur|java training|core java training|java training compa...infojaipurinfo Jaipur
 
Qb it1301
Qb   it1301Qb   it1301
Qb it1301ArthyR3
 
Java Presentation
Java PresentationJava Presentation
Java Presentationpm2214
 
Core Java introduction | Basics | free course
Core Java introduction | Basics | free course Core Java introduction | Basics | free course
Core Java introduction | Basics | free course Kernel Training
 
Java history, versions, types of errors and exception, quiz
Java history, versions, types of errors and exception, quiz Java history, versions, types of errors and exception, quiz
Java history, versions, types of errors and exception, quiz SAurabh PRajapati
 
Introduction to Java -unit-1
Introduction to Java -unit-1Introduction to Java -unit-1
Introduction to Java -unit-1RubaNagarajan
 
Java chapter 3 - OOPs concepts
Java chapter 3 - OOPs conceptsJava chapter 3 - OOPs concepts
Java chapter 3 - OOPs conceptsMukesh Tekwani
 
1 2 java development
1 2 java development1 2 java development
1 2 java developmentKen Kretsch
 
Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java ProgrammingRavi Kant Sahu
 
Java Programming for Designers
Java Programming for DesignersJava Programming for Designers
Java Programming for DesignersR. Sosa
 
Introduction to java
Introduction to java Introduction to java
Introduction to java Java Lover
 
Java programming(unit 1)
Java programming(unit 1)Java programming(unit 1)
Java programming(unit 1)SURBHI SAROHA
 

Tendances (18)

Java Presentation For Syntax
Java Presentation For SyntaxJava Presentation For Syntax
Java Presentation For Syntax
 
java training in jaipur|java training|core java training|java training compa...
 java training in jaipur|java training|core java training|java training compa... java training in jaipur|java training|core java training|java training compa...
java training in jaipur|java training|core java training|java training compa...
 
CS8392 OOP
CS8392 OOPCS8392 OOP
CS8392 OOP
 
Qb it1301
Qb   it1301Qb   it1301
Qb it1301
 
Java Presentation
Java PresentationJava Presentation
Java Presentation
 
Core Java
Core JavaCore Java
Core Java
 
Java training in delhi
Java training in delhiJava training in delhi
Java training in delhi
 
Core Java introduction | Basics | free course
Core Java introduction | Basics | free course Core Java introduction | Basics | free course
Core Java introduction | Basics | free course
 
Java history, versions, types of errors and exception, quiz
Java history, versions, types of errors and exception, quiz Java history, versions, types of errors and exception, quiz
Java history, versions, types of errors and exception, quiz
 
Java notes(OOP) jkuat IT esection
Java notes(OOP) jkuat IT esectionJava notes(OOP) jkuat IT esection
Java notes(OOP) jkuat IT esection
 
Introduction to Java -unit-1
Introduction to Java -unit-1Introduction to Java -unit-1
Introduction to Java -unit-1
 
Java chapter 3 - OOPs concepts
Java chapter 3 - OOPs conceptsJava chapter 3 - OOPs concepts
Java chapter 3 - OOPs concepts
 
Core Java Tutorial
Core Java TutorialCore Java Tutorial
Core Java Tutorial
 
1 2 java development
1 2 java development1 2 java development
1 2 java development
 
Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java Programming
 
Java Programming for Designers
Java Programming for DesignersJava Programming for Designers
Java Programming for Designers
 
Introduction to java
Introduction to java Introduction to java
Introduction to java
 
Java programming(unit 1)
Java programming(unit 1)Java programming(unit 1)
Java programming(unit 1)
 

En vedette

Lec 9 05_sept [compatibility mode]
Lec 9 05_sept [compatibility mode]Lec 9 05_sept [compatibility mode]
Lec 9 05_sept [compatibility mode]Palak Sanghani
 
Lec 6 14_aug [compatibility mode]
Lec 6 14_aug [compatibility mode]Lec 6 14_aug [compatibility mode]
Lec 6 14_aug [compatibility mode]Palak Sanghani
 
Lec 5 13_aug [compatibility mode]
Lec 5 13_aug [compatibility mode]Lec 5 13_aug [compatibility mode]
Lec 5 13_aug [compatibility mode]Palak Sanghani
 

En vedette (6)

Lec 9 05_sept [compatibility mode]
Lec 9 05_sept [compatibility mode]Lec 9 05_sept [compatibility mode]
Lec 9 05_sept [compatibility mode]
 
Comparisionof trees
Comparisionof treesComparisionof trees
Comparisionof trees
 
Lec 1 25_jul13
Lec 1 25_jul13Lec 1 25_jul13
Lec 1 25_jul13
 
Lec 6 14_aug [compatibility mode]
Lec 6 14_aug [compatibility mode]Lec 6 14_aug [compatibility mode]
Lec 6 14_aug [compatibility mode]
 
Nature
NatureNature
Nature
 
Lec 5 13_aug [compatibility mode]
Lec 5 13_aug [compatibility mode]Lec 5 13_aug [compatibility mode]
Lec 5 13_aug [compatibility mode]
 

Similaire à Lec 4 06_aug [compatibility mode]

Chapter 2.1
Chapter 2.1Chapter 2.1
Chapter 2.1sotlsoc
 
Introduction
IntroductionIntroduction
Introductionrichsoden
 
SMI - Introduction to Java
SMI - Introduction to JavaSMI - Introduction to Java
SMI - Introduction to JavaSMIJava
 
College Project - Java Disassembler - Description
College Project - Java Disassembler - DescriptionCollege Project - Java Disassembler - Description
College Project - Java Disassembler - DescriptionGanesh Samarthyam
 
Understanding and extending p2 for fun and profit
Understanding and extending p2 for fun and profitUnderstanding and extending p2 for fun and profit
Understanding and extending p2 for fun and profitPascal Rapicault
 
OOPM Introduction.ppt
OOPM Introduction.pptOOPM Introduction.ppt
OOPM Introduction.pptvijay251387
 
Elements of Java Language
Elements of Java Language Elements of Java Language
Elements of Java Language Hitesh-Java
 
Top 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdfTop 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdfUmesh Kumar
 
Object oriented programming-with_java
Object oriented programming-with_javaObject oriented programming-with_java
Object oriented programming-with_javaHarry Potter
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programmingJames Wong
 

Similaire à Lec 4 06_aug [compatibility mode] (20)

Chapter 2.1
Chapter 2.1Chapter 2.1
Chapter 2.1
 
Introduction
IntroductionIntroduction
Introduction
 
Javanotes
JavanotesJavanotes
Javanotes
 
Java notes jkuat it
Java notes jkuat itJava notes jkuat it
Java notes jkuat it
 
Javalecture 1
Javalecture 1Javalecture 1
Javalecture 1
 
SMI - Introduction to Java
SMI - Introduction to JavaSMI - Introduction to Java
SMI - Introduction to Java
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
 
Java1
Java1Java1
Java1
 
Java
Java Java
Java
 
1.introduction to java
1.introduction to java1.introduction to java
1.introduction to java
 
Java_presesntation.ppt
Java_presesntation.pptJava_presesntation.ppt
Java_presesntation.ppt
 
College Project - Java Disassembler - Description
College Project - Java Disassembler - DescriptionCollege Project - Java Disassembler - Description
College Project - Java Disassembler - Description
 
Understanding and extending p2 for fun and profit
Understanding and extending p2 for fun and profitUnderstanding and extending p2 for fun and profit
Understanding and extending p2 for fun and profit
 
OOPM Introduction.ppt
OOPM Introduction.pptOOPM Introduction.ppt
OOPM Introduction.ppt
 
Elements of Java Language
Elements of Java Language Elements of Java Language
Elements of Java Language
 
Java lab-manual
Java lab-manualJava lab-manual
Java lab-manual
 
Introduction to Core Java Programming
Introduction to Core Java ProgrammingIntroduction to Core Java Programming
Introduction to Core Java Programming
 
Top 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdfTop 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdf
 
Object oriented programming-with_java
Object oriented programming-with_javaObject oriented programming-with_java
Object oriented programming-with_java
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 

Plus de Palak Sanghani

Plus de Palak Sanghani (18)

Survey form
Survey formSurvey form
Survey form
 
Survey
SurveySurvey
Survey
 
Nature2
Nature2Nature2
Nature2
 
Texture
TextureTexture
Texture
 
Lec 11 12_sept [compatibility mode]
Lec 11 12_sept [compatibility mode]Lec 11 12_sept [compatibility mode]
Lec 11 12_sept [compatibility mode]
 
Lec 8 03_sept [compatibility mode]
Lec 8 03_sept [compatibility mode]Lec 8 03_sept [compatibility mode]
Lec 8 03_sept [compatibility mode]
 
Lec 7 28_aug [compatibility mode]
Lec 7 28_aug [compatibility mode]Lec 7 28_aug [compatibility mode]
Lec 7 28_aug [compatibility mode]
 
Lec 10 10_sept [compatibility mode]
Lec 10 10_sept [compatibility mode]Lec 10 10_sept [compatibility mode]
Lec 10 10_sept [compatibility mode]
 
Lec 3 01_aug13
Lec 3 01_aug13Lec 3 01_aug13
Lec 3 01_aug13
 
Lec 2 30_jul13
Lec 2 30_jul13Lec 2 30_jul13
Lec 2 30_jul13
 
My Structure Patterns
My Structure PatternsMy Structure Patterns
My Structure Patterns
 
My Similarity Patterns
My Similarity PatternsMy Similarity Patterns
My Similarity Patterns
 
My Radiation Patterns
My Radiation PatternsMy Radiation Patterns
My Radiation Patterns
 
My Gradation Patterns
My Gradation PatternsMy Gradation Patterns
My Gradation Patterns
 
My Circular Patterns
My Circular PatternsMy Circular Patterns
My Circular Patterns
 
My Anomaly Patterns
My Anomaly PatternsMy Anomaly Patterns
My Anomaly Patterns
 
Library of Babel Illustrations
Library of Babel IllustrationsLibrary of Babel Illustrations
Library of Babel Illustrations
 
Circle patterns
Circle patternsCircle patterns
Circle patterns
 

Dernier

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 

Dernier (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 

Lec 4 06_aug [compatibility mode]

  • 2. ObjectObject An object is anything that can be represented by data in a computer’s memory and manipulated by a computer program. Numbers, texts, pictures, sound, video ….. So on
  • 3. ObjectObject An object can be something in the physical world or even just an abstract idea. for example: An airplane, is a physical object that can be manipulated by a computer.
  • 4. ObjectObject A bank transaction is an example of an object that is not physical. To a computer, an object is simply something that can be represented by data in the computer’s memory and manipulated by computer programs
  • 5. ObjectObject The data that represent the object are organized into a set of properties. NameName:: AI 379AI 379 OwnerOwner:: Indian AirlinesIndian Airlines LocationLocation:: 39 52′ 06″N39 52′ 06″N 75 13′ 52″W75 13′ 52″W HeadingHeading:: 271271°° AltitudeAltitude:: 19 m19 m AirSpeedAirSpeed:: 00 MakeMake:: BoeingBoeing ModelModel:: 737737 WeightWeight:: 32,820 kg32,820 kg The values stored in an object’s properties, at any one time, form the state of an object.
  • 6. ObjectObject--Oriented ProgrammingOriented Programming Computer programs implement algorithms that manipulate the data. In object-oriented programming, the programs that manipulate the properties of an object are the object’s methods.
  • 7. ObjectObject--Oriented ProgrammingOriented Programming We can think of an object as a collection of properties and, the methods that are used to manipulate those properties. Properties Methods
  • 8. ObjectObject--Oriented ProgrammingOriented Programming A class is a group of objects with the same properties and the same methods.
  • 9. ObjectObject--Oriented ProgrammingOriented Programming Each copy of an object, from a particular class is called an instance, of the object. The act of creating a new instance of an object is called instantiation.
  • 10. ObjectObject--Oriented ProgrammingOriented Programming A class can be thought of as a blueprint for instances of its object. Two different instances of the same class will have the same properties, but different values stored in those properties.
  • 11. ObjectObject--Oriented ProgrammingOriented Programming The same terminology is used in most object- oriented programming languages. Object Instance Property Method Instantiation Class State
  • 13.  Development tools-part of java development kit (JDK)  Classes and methods-part of Java Standard Library (JSL), also known as Application Programming Interface (API) 1. JDK:  Appletviewer ( for viewing applets)  Javac (Compiler)  Java (Interpreter)  Javah (for C header files)  Javadoc ( for creating HTML description) Java Environment
  • 14. 2. Application Package Interface (API) Contains hundreds of classes and methods grouped into several functional packages:  Language Support Package (String, Integer, Double, etc)  Utility Packages (rand. num. gen., sys. date)  Input/Output Packages  Networking Packages (implementing networking appl. )  AWT Package (classes for painting graphics and images)  Applet Package (web page using java) Java Environment
  • 15. 1. Java 1.0 (96) 2. Java 1.1 (97)(Add new library, redefine applet handling and reconfigured many features.) 3. Java 2 (98)(Second generation). Version no:1.2 (Internal version number of java library). Also known as J2SE [ Java 2 Platform Standard Edition]. - Add swing, the collection framework, enhanced JVM etc. 4. J2SE 1.3 (2000) 5. J2SE 1.4 (2002) 6. J2SE 1.5 (2004) 7. J2SE 1.6 (2006) [1.7-(2013), in queue 1.8 (exp in 2014) ] The Evolution of Java
  • 16. Comments In Java, comments are preceded by two slashes (//) in a line, or enclosed between /* and */ in one or multiple lines When the compiler sees //, it ignores all text after // in the same line When it sees /*, it scans for the next */ and ignores any text between /* and */
  • 17. Example /* Traditional "Hello World!" program. */ // package pack1; // import java.lang.System; class A { public static void main (String args[]) { System.out.println("Hello World!"); } } Save program as A.java
  • 18. Java Program Structure Package Statement  Javac command compiles the source code A.java then, generates A.class and store it under a directory which is called as name of the package  package statement if used must be the first statement in a compilation unit. Its syntax is: package packageName;  For example: package pack1;
  • 19. Import Statement  The import statements are similar to #include statements in C and C++  In the above program, System class of java.lang package is imported into all Java programs by default. The syntax of import statement is as: import fullClassName;  For example, the following import statement imports the System class from java.lang: import java.lang.System; import java.lang.*;
  • 20. Classes and Methods  Class declarations contain a keyword class and an identifier (Ex: A)  Class members are enclosed within braces. The syntax of defining a class is shown below: class A { // program code }  To execute a class, it must contain a valid main method  It is the first method that automatically gets invoked when the program executed public static void main (String args[]) { //instructions }