SlideShare uma empresa Scribd logo
1 de 4
Baixar para ler offline
Core Java

Debasish Pratihari

Introduction to OOPs:


Object-oriented programming provides a
superior way of organizing programming
projects



It encourages a high degree of modularity in
programming, making large projects easier to
implement



It provides powerful techniques like inheritance
and polymorphism to help organize and reuse
code

Features of OOPs:



Abstraction



Encapsulation



Inheritance



Polymorphism

Procedural vs. Object-Oriented Programming :


The unit in procedural programming is function,
and unit in object-oriented programming is class



Procedural
programming
concentrates on
creating
functions, while
object-oriented
programming starts from isolating the classes,
and then look for the methods inside them.



Procedural programming separates the data of
the
program from the
operations that
manipulate the data, while object-oriented
programming focus on both of them

Lecture/core/oops1/08

Page #1

feel the Technology…
Core Java

Debasish Pratihari

Introduction to Class :


In object-oriented programming, a class is a
programming language construct that is used as a
blueprint or prototype to create objects.



it is an abstraction of a concept within a computer
program.



It encapsulates state through data placeholders
called member variables or fields; it encapsulates
behavior through reusable code called methods or
behavior.



A class has a constructor for creating objects

Member of a class











Instance variable
Class variable
Local variable
Instance method
Class methods
Constructors
Initialization codec(Static
code blocks)
Finalize method
Class (inner class)
interface

or

non-static

The Java Language Specification allows the
followings:


Declare a class inside another class or inside an
interface.



Declare an interface inside another interface or
inside a class.



Declare a class inside a method.



Nest classes and interfaces declarations
arbitrarily deep.

Lecture/core/oops1/08

Page #2

feel the Technology…
Core Java

Debasish Pratihari

Declaring a class:
Syntax :
<class modifier> class <identifier>{
// Body here

}

Example:
public class Laskhya{
//Body here

}

Access Modifiers:


Keywords that help to set the visibility,
accessibility, or certain properties of a class, its
member variables, and methods.
Class Modifiers
For Outer class





public
abstract
final
strictfp

For inner class
 private
 public
 protected
 abstract
 final
 strictfp

Note:

A class can’t be both
final and abstract

Field Declaration :


a type name followed by the field name, and
optionally an initialization clause



field declarations can be preceded by different
modifiers





Lecture/core/oops1/08

private
public
protected
transient





volatile
static
final

Page #3

Note:

A field can’t be both
final and volatile

feel the Technology…
Core Java

Debasish Pratihari

Access control modifiers:


private: private members are accessible only in
the class itself.



package: package members are accessible in
classes in the same package and the class itself.



protected: protected members are accessible in
classes in the same package, in subclasses of
the class, and in the class itself.



public: public members are accessible
anywhere the class is accessible.

static modifier :
25%
 only one copy of the static field exists, shared
by all objects of this class


can be accessed directly in the class itself



access from outside the class must be preceded
by the class name or via an object belonging to
the class



from outside the class, non-static fields must be
accessed through an object reference

Final modifier :


once initialized, the value cannot be changed



often be used to define named constants



static final fields must be initialized when the
class is initialized



non-static final fields must be initialized when an
object of the class is constructed

Lecture/core/oops1/08

Page #4

feel the Technology…

Mais conteúdo relacionado

Mais procurados

12 object oriented programming
12 object oriented programming12 object oriented programming
12 object oriented programming
jigeno
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
thinkphp
 

Mais procurados (20)

Data Structure Interview Questions & Answers
Data Structure Interview Questions & AnswersData Structure Interview Questions & Answers
Data Structure Interview Questions & Answers
 
OOP_1_TEG
OOP_1_TEGOOP_1_TEG
OOP_1_TEG
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
 
Lecture 18
Lecture 18Lecture 18
Lecture 18
 
Oops And C++ Fundamentals
Oops And C++ FundamentalsOops And C++ Fundamentals
Oops And C++ Fundamentals
 
Unusual C# - OOP
Unusual C# - OOPUnusual C# - OOP
Unusual C# - OOP
 
C++ OOPS Concept
C++ OOPS ConceptC++ OOPS Concept
C++ OOPS Concept
 
Suga java training_with_footer
Suga java training_with_footerSuga java training_with_footer
Suga java training_with_footer
 
Total oop in c# dot net
Total oop in c# dot netTotal oop in c# dot net
Total oop in c# dot net
 
12 object oriented programming
12 object oriented programming12 object oriented programming
12 object oriented programming
 
C plusplus
C plusplusC plusplus
C plusplus
 
Ashish oot
Ashish ootAshish oot
Ashish oot
 
OOP in C#
OOP in C#OOP in C#
OOP in C#
 
General oops concepts
General oops conceptsGeneral oops concepts
General oops concepts
 
Oopsinphp
OopsinphpOopsinphp
Oopsinphp
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
 
Object Oriented Programming Overview for the PeopleSoft Developer
Object Oriented Programming Overview for the PeopleSoft DeveloperObject Oriented Programming Overview for the PeopleSoft Developer
Object Oriented Programming Overview for the PeopleSoft Developer
 
Oop
OopOop
Oop
 
Oop concepts
Oop conceptsOop concepts
Oop concepts
 
12th ip CBSE chapter 4 oop in java notes complete
12th ip CBSE  chapter 4 oop in java notes complete12th ip CBSE  chapter 4 oop in java notes complete
12th ip CBSE chapter 4 oop in java notes complete
 

Destaque

Cat And Mouse Story
Cat And Mouse StoryCat And Mouse Story
Cat And Mouse Story
guestd57ddf
 
Loraine Slinn at LP2010
Loraine Slinn at LP2010Loraine Slinn at LP2010
Loraine Slinn at LP2010
Paul McElvaney
 
I don't know,But I konw
I don't know,But I konwI don't know,But I konw
I don't know,But I konw
fengleilei
 
Right People For The Right Job!
Right People For The Right Job!Right People For The Right Job!
Right People For The Right Job!
Geethashree N
 
Festa Do Milho -09.07.07
Festa Do Milho -09.07.07Festa Do Milho -09.07.07
Festa Do Milho -09.07.07
Jubrac Jacui
 

Destaque (20)

Lecture 6
Lecture 6Lecture 6
Lecture 6
 
Twitter Marketing 101
Twitter Marketing 101Twitter Marketing 101
Twitter Marketing 101
 
Cat And Mouse Story
Cat And Mouse StoryCat And Mouse Story
Cat And Mouse Story
 
Matteo baccan raspberry pi - linox 2014
Matteo baccan   raspberry pi - linox 2014Matteo baccan   raspberry pi - linox 2014
Matteo baccan raspberry pi - linox 2014
 
Loraine Slinn at LP2010
Loraine Slinn at LP2010Loraine Slinn at LP2010
Loraine Slinn at LP2010
 
Workshop digitaal branden
Workshop digitaal brandenWorkshop digitaal branden
Workshop digitaal branden
 
Weather qube
Weather qubeWeather qube
Weather qube
 
Aag presentatie 3 februari
Aag presentatie 3 februariAag presentatie 3 februari
Aag presentatie 3 februari
 
I don't know,But I konw
I don't know,But I konwI don't know,But I konw
I don't know,But I konw
 
280 slides
280 slides280 slides
280 slides
 
Lecture 14
Lecture 14Lecture 14
Lecture 14
 
Lecture 24
Lecture 24Lecture 24
Lecture 24
 
JIPDay 2005: Xlet Java Programming
JIPDay 2005: Xlet Java ProgrammingJIPDay 2005: Xlet Java Programming
JIPDay 2005: Xlet Java Programming
 
Lecture25
Lecture25Lecture25
Lecture25
 
Newmedia Congres Webversie
Newmedia Congres WebversieNewmedia Congres Webversie
Newmedia Congres Webversie
 
Right People For The Right Job!
Right People For The Right Job!Right People For The Right Job!
Right People For The Right Job!
 
Niver Fe 18.02.07
Niver Fe 18.02.07Niver Fe 18.02.07
Niver Fe 18.02.07
 
Presentatie avans1
Presentatie avans1Presentatie avans1
Presentatie avans1
 
Presentatie social media Adformatie (2)
Presentatie social media Adformatie (2)Presentatie social media Adformatie (2)
Presentatie social media Adformatie (2)
 
Festa Do Milho -09.07.07
Festa Do Milho -09.07.07Festa Do Milho -09.07.07
Festa Do Milho -09.07.07
 

Semelhante a Lecture 8

Object oriented basics
Object oriented basicsObject oriented basics
Object oriented basics
vamshimahi
 

Semelhante a Lecture 8 (20)

Oops abap fundamental
Oops abap fundamentalOops abap fundamental
Oops abap fundamental
 
What is OOP_ (Object Oriented Programming) (1).pptx
What is OOP_ (Object Oriented Programming) (1).pptxWhat is OOP_ (Object Oriented Programming) (1).pptx
What is OOP_ (Object Oriented Programming) (1).pptx
 
OOP Introduction with java programming language
OOP Introduction with java programming languageOOP Introduction with java programming language
OOP Introduction with java programming language
 
OOP in Java Presentation.pptx
OOP in Java Presentation.pptxOOP in Java Presentation.pptx
OOP in Java Presentation.pptx
 
OOP interview questions & answers.
OOP interview questions & answers.OOP interview questions & answers.
OOP interview questions & answers.
 
OOPS
OOPSOOPS
OOPS
 
Oops concepts
Oops conceptsOops concepts
Oops concepts
 
Nitish Chaulagai Java1.pptx
Nitish Chaulagai Java1.pptxNitish Chaulagai Java1.pptx
Nitish Chaulagai Java1.pptx
 
Java Interview Questions
Java Interview QuestionsJava Interview Questions
Java Interview Questions
 
Features of Object Oriented Programming.pptx
Features of Object Oriented Programming.pptxFeatures of Object Oriented Programming.pptx
Features of Object Oriented Programming.pptx
 
chapter 5 concepts of object oriented programming
chapter 5 concepts of object oriented programmingchapter 5 concepts of object oriented programming
chapter 5 concepts of object oriented programming
 
oopsinvb-191021101327.pdf
oopsinvb-191021101327.pdfoopsinvb-191021101327.pdf
oopsinvb-191021101327.pdf
 
Oops in vb
Oops in vbOops in vb
Oops in vb
 
Chapter-3 Scoping.pptx
Chapter-3 Scoping.pptxChapter-3 Scoping.pptx
Chapter-3 Scoping.pptx
 
1
11
1
 
Object oriented basics
Object oriented basicsObject oriented basics
Object oriented basics
 
Java questions for interview
Java questions for interviewJava questions for interview
Java questions for interview
 
Core java questions
Core java questionsCore java questions
Core java questions
 
Lecture 10
Lecture 10Lecture 10
Lecture 10
 
java part 1 computer science.pptx
java part 1 computer science.pptxjava part 1 computer science.pptx
java part 1 computer science.pptx
 

Mais de Debasish Pratihari (15)

Lecture 23
Lecture 23Lecture 23
Lecture 23
 
Lecture 22
Lecture 22Lecture 22
Lecture 22
 
Lecture 21
Lecture 21Lecture 21
Lecture 21
 
Lecture 20
Lecture 20Lecture 20
Lecture 20
 
Lecture 19
Lecture 19Lecture 19
Lecture 19
 
Lecture 18
Lecture 18Lecture 18
Lecture 18
 
Lecture 17
Lecture 17Lecture 17
Lecture 17
 
Lecture 16
Lecture 16Lecture 16
Lecture 16
 
Lecture 9
Lecture 9Lecture 9
Lecture 9
 
Lecture 7
Lecture 7Lecture 7
Lecture 7
 
Lecture 5
Lecture 5Lecture 5
Lecture 5
 
Lecture 4
Lecture 4Lecture 4
Lecture 4
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 

Último

Último (20)

Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 

Lecture 8

  • 1. Core Java Debasish Pratihari Introduction to OOPs:  Object-oriented programming provides a superior way of organizing programming projects  It encourages a high degree of modularity in programming, making large projects easier to implement  It provides powerful techniques like inheritance and polymorphism to help organize and reuse code Features of OOPs:  Abstraction  Encapsulation  Inheritance  Polymorphism Procedural vs. Object-Oriented Programming :  The unit in procedural programming is function, and unit in object-oriented programming is class  Procedural programming concentrates on creating functions, while object-oriented programming starts from isolating the classes, and then look for the methods inside them.  Procedural programming separates the data of the program from the operations that manipulate the data, while object-oriented programming focus on both of them Lecture/core/oops1/08 Page #1 feel the Technology…
  • 2. Core Java Debasish Pratihari Introduction to Class :  In object-oriented programming, a class is a programming language construct that is used as a blueprint or prototype to create objects.  it is an abstraction of a concept within a computer program.  It encapsulates state through data placeholders called member variables or fields; it encapsulates behavior through reusable code called methods or behavior.  A class has a constructor for creating objects Member of a class           Instance variable Class variable Local variable Instance method Class methods Constructors Initialization codec(Static code blocks) Finalize method Class (inner class) interface or non-static The Java Language Specification allows the followings:  Declare a class inside another class or inside an interface.  Declare an interface inside another interface or inside a class.  Declare a class inside a method.  Nest classes and interfaces declarations arbitrarily deep. Lecture/core/oops1/08 Page #2 feel the Technology…
  • 3. Core Java Debasish Pratihari Declaring a class: Syntax : <class modifier> class <identifier>{ // Body here } Example: public class Laskhya{ //Body here } Access Modifiers:  Keywords that help to set the visibility, accessibility, or certain properties of a class, its member variables, and methods. Class Modifiers For Outer class     public abstract final strictfp For inner class  private  public  protected  abstract  final  strictfp Note: A class can’t be both final and abstract Field Declaration :  a type name followed by the field name, and optionally an initialization clause  field declarations can be preceded by different modifiers     Lecture/core/oops1/08 private public protected transient    volatile static final Page #3 Note: A field can’t be both final and volatile feel the Technology…
  • 4. Core Java Debasish Pratihari Access control modifiers:  private: private members are accessible only in the class itself.  package: package members are accessible in classes in the same package and the class itself.  protected: protected members are accessible in classes in the same package, in subclasses of the class, and in the class itself.  public: public members are accessible anywhere the class is accessible. static modifier : 25%  only one copy of the static field exists, shared by all objects of this class  can be accessed directly in the class itself  access from outside the class must be preceded by the class name or via an object belonging to the class  from outside the class, non-static fields must be accessed through an object reference Final modifier :  once initialized, the value cannot be changed  often be used to define named constants  static final fields must be initialized when the class is initialized  non-static final fields must be initialized when an object of the class is constructed Lecture/core/oops1/08 Page #4 feel the Technology…