SlideShare a Scribd company logo
INTRODUCTION TO OOP AND
JAVA FUNDAMENTALS
N.ANSGAR MARY
AP/IT
Unit I
• Object Oriented Programming - Abstraction –
objects and classes - Encapsulation- Inheritance-
Polymorphism- OOP in Java – Characteristics of
Java – The Java Environment - Java Source File -
Structure Compilation. Fundamental
Programming Structures in Java – Defining classes
in Java – constructors, methods - access specifiers
- static members - Comments, Data Types,
Variables, Operators, Control Flow, Arrays,
Packages - JavaDoc comments.
OBJECT-ORIENTED PROGRAMMING
Object-Oriented Programming (OOP) is a programming
language model organized around objects rather than
actions and data. An object-oriented program can be
characterized as data controlling access to code. Concepts
of OOPS
• Object
• Class
• Inheritance
• Polymorphism
• Abstraction
• Encapsulation
OBJECT
• Object means a real word entity such as pen, chair, table etc.
• Any entity that has state and behavior is known as an object.
• Object can be defined as an instance of a class.
• An object contains an address and takes up some space in memory. Objects can
communicate without knowing details of each other's data or code, the only
necessary thing is that the type of message accepted and type of response
returned by the objects.
• An object has three characteristics:
• state: represents data (value) of an object.
• behavior: represents the behavior (functionality) of an object such as deposit,
withdraw etc.
• identity: Object identity is typically implemented via a unique ID. The value of the
ID is not visible to the external user. But, it is used internally by the JVM to identify
each object uniquely.
Example of an object : dog1
CLASS
• Collection of objects is called class.
• It is a logical entity.
• A class can also be defined as a blueprint from which
you can create an individual object.
• A class consists of Data members and methods.
• The primary purpose of a class is to hold
data/information.
• The member functions determine the behavior of the
class, i.e. provide a definition for supporting various
operations on data held in the form of an object.
• Class doesn’t store any space.
Example
public class Dog
{
String breed;
int age;
String color;
void barking()
{ }
void hungry()
{ }
void sleeping()
{ }
}
Constructors
• Each time a new object is created, at least one
constructor will be invoked. The main rule of
constructors is that they should have the same name
as the class. A class can have more than one
constructor.
Following is an example of a constructor −
Example
public class Puppy
{
public Puppy()
{ }
public Puppy(String name)
{ // This constructor has one parameter, name. } }
INHERITANCE
• Inheritance can be defined as the procedure or mechanism
of acquiring all the properties and behavior of one class to
another, i.e., acquiring the properties and behavior of child
class from the parent class.
• When one object acquires all the properties and
behaviours of another object, it is known as inheritance.
• It provides code reusability and establishes relationships
between different classes. A class which inherits the
properties is known as Child Class(sub-class or derived
class) whereas a class whose properties are inherited is
known as Parent class(super-class or base class).
• Types of inheritance in java: single, multilevel and
hierarchical inheritance. Multiple and hybrid inheritance is
supported through interface only.
POLYMORPHISM
• When one task is performed by different ways
i.e. known as polymorphism. For example: to
draw something e.g. shape or rectangle etc.
Polymorphism is classified into two ways:
Method Overloading(Compile time Polymorphism)
• Method Overloading is a feature that allows a class to
have two or more methods having the same name but
the arguments passed to the methods are different.
Compile time polymorphism refers to a process in
which a call to an overloaded method is resolved at
compile time rather than at run time.
Method Overriding(Run time Polymorphism)
• If subclass (child class) has the same method as
declared in the parent class, it is known as method
overriding in java. In other words, If subclass provides
the specific implementation of the method that has
been provided by one of its parent class, it is known as
method overriding.
ABSTRACTION
• Abstraction refers to the act of representing
essential features without including the
background details or explanations.
For example: phone call, we don't know the
internal processing. In java, we use abstract class
and interface to achieve abstraction.
ENCAPSULATION
• The wrapping up of data and methods into a single unit (called class) is known as
encapsulation.
• Data encapsulation is the most striking feature of a class. The data is not accessible
to' the outside world and only those methods, which are wrapped in the class, can
access it. These methods provide the interface between the object's data and the
program.
• i.e. mixed of several medicines. A java class is the example of encapsulation.
• This insulation of the data from direct access by 'the program is called data hiding.
Message Communication:
• 1. Creating classes that define objects and
their behaviour.
• 2. Creating objects from class definitions.
• 3. Establishing communication among objects.
Dynamic Binding
• Dynamic binding means that the code
associated with a given procedure call is not
known until the time of the call at runtime.
DIFFERENCE BETWEEN PROCEDURE-ORIENTED AND OBJECT-ORIENTED
PROGRAMMING
JAVA
• Java is a robust, general-purpose, high-level
programming language and a powerful software
platform. It is also object-oriented, distributed,
portable and multi-threaded. Java follows the 'Write -
once - run - anywhere' approach.
• All Java programs must run on the Java platform that
has two components,
i. Java Virtual Machine (JVM)
Ii.Java Application Programming Interface (API).
• With Java API, many types of Java programs can be
developed. These include
Java stand-alone applications
Java Applets
Java Servlets
Characteristics of Java language
• Compiled and Interpreted
• Platform-Independent and Portable
• Object-Oriented
• Robust and Secure
• Distributed
• Familiar, Simple. and Small
• Multithreaded and Interactive
• High Performance
• Dynamic and Extensible
THE JAVA PROGRAMMING
ENVIRONMENT:
STRUCTURE OF JAVA PROGRAM
A Java program involves the following sections:
• Documentation Section
• Package Statement
• Import Statements
• Interface Statement
• Class Definition
• Main Method Class
• Main Method Definition
COMPILATION AND EXECUTION OF A
JAVA PROGRAMCompilation
• First, the source .java‘ file is passed through the compiler, which
then encodes the source code into a machine independent
encoding, known as Bytecode. The content of each class contained
in the source file is stored in a separate .class‘ file.
Execution
• The class files generated by the compiler are independent of the
machine or the OS, which allows them to be run on any system. To
run, the main class file (the class that contains the method main) is
passed to the JVM, and then goes through three main stages before
the final machine code is executed. These stages are:
a. Class Loader
b.Bytecode Verifier
c.Just-In-Time Compiler
FUNDAMENTAL PROGRAMMING
STRUCTURES IN JAVA
• COMMENTS
– System.out.println("Hello, World!"); // comment
– /* and */
– /** to start and a */ to end
public class JavaApplication1
{
public static void main(String[] args)
{
System.out.println("welcome");
}
}
DATA TYPES
1) Integers
• Java defines four integer types: byte, short,
int, and long.
2. Floating-Point Types
3. Characters
It is a unification of dozens of character sets, such as Latin,
Greek, Arabic, Cyrillic, Hebrew, Katakana, Hangul, and many
more. For this purpose, it requires 16 bits. Thus, in Java char is
a 16-bit type. The range of a char is 0 to 65,536.
Although char is designed to hold Unicode characters, it can
also be thought of as an integer type on which you can
perform arithmetic operations
4. Booleans
Literals
• 1. Integer Literals
• 2. Floating-Point Literals
• 3. Boolean Literals
• 4. Character Literals
• 5. String Literals
VARIABLES• The variable is the basic unit of storage in a Java program.
• Declaring a Variable
type identifier [ = value][, identifier [= value] ...] ;
• int a, b, c; // declares three ints, a, b, and c.
• int d = 3, e, f = 5; // declares three more ints, initializing // d and f.
Dynamic Initialization:
double c = Math.sqrt(a * a + b * b);
The Scope and Lifetime of Variables
There are two general categories of scopes:
• global and
• local
Type Conversion and Casting -int value to a long variable
Casting Incompatible Types
int a;
byte b;
// ...
b = (byte) a;
OPERATORS
• 1. Arithmetic Operators:
• 2. The Bitwise Operators
• 3. Relational Operators
• 4. Boolean Logical Operators
• 5. Short-Circuit Logical Operators
• 6. The Assignment Operator:
• 7. The ? Operator
– General form:
– expression1 ? expression2 : expression3
CONTROL STATEMENTS
Java‘s program control statements can be put
into the following categories:
• Selection statements
• Iteration statements
• Jump statements
1. Selection statements
Java supports two selection statements:
• if
• switch
2. Iteration Statements
Java‘s iteration statements are
• for
for(initialization; condition; iteration) {
// body
}
• do-while
• while
while(condition) {
// body of loop
}
• do-while

More Related Content

What's hot

Operator overloading C++
Operator overloading C++Operator overloading C++
Operator overloading C++
Lahiru Dilshan
 
Data types in java
Data types in javaData types in java
Data types in java
HarshitaAshwani
 
Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)
MD Sulaiman
 
Data types in c++
Data types in c++Data types in c++
Data types in c++
Venkata.Manish Reddy
 
Basic concept of OOP's
Basic concept of OOP'sBasic concept of OOP's
Basic concept of OOP's
Prof. Dr. K. Adisesha
 
Core java complete ppt(note)
Core java  complete  ppt(note)Core java  complete  ppt(note)
Core java complete ppt(note)
arvind pandey
 
Queue - Data Structure - Notes
Queue - Data Structure - NotesQueue - Data Structure - Notes
Queue - Data Structure - Notes
Omprakash Chauhan
 
Fundamentals of data structures ellis horowitz & sartaj sahni
Fundamentals of data structures   ellis horowitz & sartaj sahniFundamentals of data structures   ellis horowitz & sartaj sahni
Fundamentals of data structures ellis horowitz & sartaj sahniHitesh Wagle
 
Basics of c++ Programming Language
Basics of c++ Programming LanguageBasics of c++ Programming Language
Basics of c++ Programming Language
Ahmad Idrees
 
Function overloading(c++)
Function overloading(c++)Function overloading(c++)
Function overloading(c++)
Ritika Sharma
 
Class and object in C++
Class and object in C++Class and object in C++
Class and object in C++
rprajat007
 
object oriented Programming ppt
object oriented Programming pptobject oriented Programming ppt
object oriented Programming ppt
Nitesh Dubey
 
Polymorphism In c++
Polymorphism In c++Polymorphism In c++
Polymorphism In c++
Vishesh Jha
 
Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithmsPiyush Rochwani
 
CS3391 -OOP -UNIT – I NOTES FINAL.pdf
CS3391 -OOP -UNIT – I  NOTES FINAL.pdfCS3391 -OOP -UNIT – I  NOTES FINAL.pdf
CS3391 -OOP -UNIT – I NOTES FINAL.pdf
AALIM MUHAMMED SALEGH COLLEGE OF ENGINEERING
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
Iqra khalil
 
Object Oriented Programming Concepts for beginners
Object Oriented Programming Concepts for beginners Object Oriented Programming Concepts for beginners
Object Oriented Programming Concepts for beginners
Vibhawa Nirmal
 
Object oriented programming concepts
Object oriented programming conceptsObject oriented programming concepts
Object oriented programming concepts
rahuld115
 

What's hot (20)

Operator overloading C++
Operator overloading C++Operator overloading C++
Operator overloading C++
 
Data types in java
Data types in javaData types in java
Data types in java
 
Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)
 
Data types in c++
Data types in c++Data types in c++
Data types in c++
 
Basic concept of OOP's
Basic concept of OOP'sBasic concept of OOP's
Basic concept of OOP's
 
Core java complete ppt(note)
Core java  complete  ppt(note)Core java  complete  ppt(note)
Core java complete ppt(note)
 
Queue - Data Structure - Notes
Queue - Data Structure - NotesQueue - Data Structure - Notes
Queue - Data Structure - Notes
 
Fundamentals of data structures ellis horowitz & sartaj sahni
Fundamentals of data structures   ellis horowitz & sartaj sahniFundamentals of data structures   ellis horowitz & sartaj sahni
Fundamentals of data structures ellis horowitz & sartaj sahni
 
Basics of c++ Programming Language
Basics of c++ Programming LanguageBasics of c++ Programming Language
Basics of c++ Programming Language
 
Function overloading(c++)
Function overloading(c++)Function overloading(c++)
Function overloading(c++)
 
Paging and segmentation
Paging and segmentationPaging and segmentation
Paging and segmentation
 
Class and object in C++
Class and object in C++Class and object in C++
Class and object in C++
 
object oriented Programming ppt
object oriented Programming pptobject oriented Programming ppt
object oriented Programming ppt
 
Polymorphism In c++
Polymorphism In c++Polymorphism In c++
Polymorphism In c++
 
Packages in java
Packages in javaPackages in java
Packages in java
 
Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithms
 
CS3391 -OOP -UNIT – I NOTES FINAL.pdf
CS3391 -OOP -UNIT – I  NOTES FINAL.pdfCS3391 -OOP -UNIT – I  NOTES FINAL.pdf
CS3391 -OOP -UNIT – I NOTES FINAL.pdf
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
 
Object Oriented Programming Concepts for beginners
Object Oriented Programming Concepts for beginners Object Oriented Programming Concepts for beginners
Object Oriented Programming Concepts for beginners
 
Object oriented programming concepts
Object oriented programming conceptsObject oriented programming concepts
Object oriented programming concepts
 

Similar to Introduction to oop and java fundamentals

U1 JAVA.pptx
U1 JAVA.pptxU1 JAVA.pptx
U1 JAVA.pptx
madan r
 
Java OOP s concepts and buzzwords
Java OOP s concepts and buzzwordsJava OOP s concepts and buzzwords
Java OOP s concepts and buzzwords
Raja Sekhar
 
Introduction to OOP concepts
Introduction to OOP conceptsIntroduction to OOP concepts
Introduction to OOP concepts
Ahmed Farag
 
CS8392 OOP
CS8392 OOPCS8392 OOP
oop unit1.pptx
oop unit1.pptxoop unit1.pptx
oop unit1.pptx
sureshkumara29
 
Java_notes.ppt
Java_notes.pptJava_notes.ppt
Java_notes.ppt
tuyambazejeanclaude
 
Complete PPT about the Java lokesh kept it
Complete PPT about the Java lokesh kept itComplete PPT about the Java lokesh kept it
Complete PPT about the Java lokesh kept it
lokeshpappaka10
 
oop.pptx
oop.pptxoop.pptx
oop.pptx
KabitaParajuli3
 
Core java lessons
Core java lessonsCore java lessons
Core java lessons
vivek shah
 
java-corporate-training-institute-in-mumbai
java-corporate-training-institute-in-mumbaijava-corporate-training-institute-in-mumbai
java-corporate-training-institute-in-mumbai
Unmesh Baile
 
java-corporate-training-institute-in-mumbai
java-corporate-training-institute-in-mumbaijava-corporate-training-institute-in-mumbai
java-corporate-training-institute-in-mumbai
vibrantuser
 
Principles and advantages of oop ppt
Principles and advantages of oop pptPrinciples and advantages of oop ppt
Principles and advantages of oop ppt
daxesh chauhan
 
Cs8392 oops 5 units notes
Cs8392 oops 5 units notes Cs8392 oops 5 units notes
Cs8392 oops 5 units notes
Narayanan sockalinganathan
 
Object Oriented Programming Tutorial.pptx
Object Oriented Programming Tutorial.pptxObject Oriented Programming Tutorial.pptx
Object Oriented Programming Tutorial.pptx
ethiouniverse
 
java01.ppt
java01.pptjava01.ppt
java01.ppt
FakeBuddy2
 
java01.ppt
java01.pptjava01.ppt
java01.ppt
ssuser73c6451
 
java01.ppt
java01.pptjava01.ppt
java01.ppt
ROGNationYT
 
java01.ppt
java01.pptjava01.ppt
java01.ppt
JyoGen
 

Similar to Introduction to oop and java fundamentals (20)

U1 JAVA.pptx
U1 JAVA.pptxU1 JAVA.pptx
U1 JAVA.pptx
 
Java OOP s concepts and buzzwords
Java OOP s concepts and buzzwordsJava OOP s concepts and buzzwords
Java OOP s concepts and buzzwords
 
Introduction to OOP concepts
Introduction to OOP conceptsIntroduction to OOP concepts
Introduction to OOP concepts
 
CS8392 OOP
CS8392 OOPCS8392 OOP
CS8392 OOP
 
oop unit1.pptx
oop unit1.pptxoop unit1.pptx
oop unit1.pptx
 
Java_notes.ppt
Java_notes.pptJava_notes.ppt
Java_notes.ppt
 
Complete PPT about the Java lokesh kept it
Complete PPT about the Java lokesh kept itComplete PPT about the Java lokesh kept it
Complete PPT about the Java lokesh kept it
 
oop.pptx
oop.pptxoop.pptx
oop.pptx
 
Core java lessons
Core java lessonsCore java lessons
Core java lessons
 
Java
JavaJava
Java
 
java-corporate-training-institute-in-mumbai
java-corporate-training-institute-in-mumbaijava-corporate-training-institute-in-mumbai
java-corporate-training-institute-in-mumbai
 
java-corporate-training-institute-in-mumbai
java-corporate-training-institute-in-mumbaijava-corporate-training-institute-in-mumbai
java-corporate-training-institute-in-mumbai
 
Principles and advantages of oop ppt
Principles and advantages of oop pptPrinciples and advantages of oop ppt
Principles and advantages of oop ppt
 
Cs8392 oops 5 units notes
Cs8392 oops 5 units notes Cs8392 oops 5 units notes
Cs8392 oops 5 units notes
 
Object Oriented Programming Tutorial.pptx
Object Oriented Programming Tutorial.pptxObject Oriented Programming Tutorial.pptx
Object Oriented Programming Tutorial.pptx
 
java01.ppt
java01.pptjava01.ppt
java01.ppt
 
java01.ppt
java01.pptjava01.ppt
java01.ppt
 
java01.ppt
java01.pptjava01.ppt
java01.ppt
 
java01.ppt
java01.pptjava01.ppt
java01.ppt
 
java01.ppt
java01.pptjava01.ppt
java01.ppt
 

Recently uploaded

AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 

Recently uploaded (20)

AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 

Introduction to oop and java fundamentals

  • 1. INTRODUCTION TO OOP AND JAVA FUNDAMENTALS N.ANSGAR MARY AP/IT
  • 2.
  • 3. Unit I • Object Oriented Programming - Abstraction – objects and classes - Encapsulation- Inheritance- Polymorphism- OOP in Java – Characteristics of Java – The Java Environment - Java Source File - Structure Compilation. Fundamental Programming Structures in Java – Defining classes in Java – constructors, methods - access specifiers - static members - Comments, Data Types, Variables, Operators, Control Flow, Arrays, Packages - JavaDoc comments.
  • 4. OBJECT-ORIENTED PROGRAMMING Object-Oriented Programming (OOP) is a programming language model organized around objects rather than actions and data. An object-oriented program can be characterized as data controlling access to code. Concepts of OOPS • Object • Class • Inheritance • Polymorphism • Abstraction • Encapsulation
  • 5.
  • 6. OBJECT • Object means a real word entity such as pen, chair, table etc. • Any entity that has state and behavior is known as an object. • Object can be defined as an instance of a class. • An object contains an address and takes up some space in memory. Objects can communicate without knowing details of each other's data or code, the only necessary thing is that the type of message accepted and type of response returned by the objects. • An object has three characteristics: • state: represents data (value) of an object. • behavior: represents the behavior (functionality) of an object such as deposit, withdraw etc. • identity: Object identity is typically implemented via a unique ID. The value of the ID is not visible to the external user. But, it is used internally by the JVM to identify each object uniquely.
  • 7. Example of an object : dog1
  • 8. CLASS • Collection of objects is called class. • It is a logical entity. • A class can also be defined as a blueprint from which you can create an individual object. • A class consists of Data members and methods. • The primary purpose of a class is to hold data/information. • The member functions determine the behavior of the class, i.e. provide a definition for supporting various operations on data held in the form of an object. • Class doesn’t store any space.
  • 9.
  • 10.
  • 11. Example public class Dog { String breed; int age; String color; void barking() { } void hungry() { } void sleeping() { } }
  • 12. Constructors • Each time a new object is created, at least one constructor will be invoked. The main rule of constructors is that they should have the same name as the class. A class can have more than one constructor. Following is an example of a constructor − Example public class Puppy { public Puppy() { } public Puppy(String name) { // This constructor has one parameter, name. } }
  • 13.
  • 14. INHERITANCE • Inheritance can be defined as the procedure or mechanism of acquiring all the properties and behavior of one class to another, i.e., acquiring the properties and behavior of child class from the parent class. • When one object acquires all the properties and behaviours of another object, it is known as inheritance. • It provides code reusability and establishes relationships between different classes. A class which inherits the properties is known as Child Class(sub-class or derived class) whereas a class whose properties are inherited is known as Parent class(super-class or base class). • Types of inheritance in java: single, multilevel and hierarchical inheritance. Multiple and hybrid inheritance is supported through interface only.
  • 15.
  • 16. POLYMORPHISM • When one task is performed by different ways i.e. known as polymorphism. For example: to draw something e.g. shape or rectangle etc.
  • 17. Polymorphism is classified into two ways: Method Overloading(Compile time Polymorphism) • Method Overloading is a feature that allows a class to have two or more methods having the same name but the arguments passed to the methods are different. Compile time polymorphism refers to a process in which a call to an overloaded method is resolved at compile time rather than at run time. Method Overriding(Run time Polymorphism) • If subclass (child class) has the same method as declared in the parent class, it is known as method overriding in java. In other words, If subclass provides the specific implementation of the method that has been provided by one of its parent class, it is known as method overriding.
  • 18. ABSTRACTION • Abstraction refers to the act of representing essential features without including the background details or explanations. For example: phone call, we don't know the internal processing. In java, we use abstract class and interface to achieve abstraction.
  • 19. ENCAPSULATION • The wrapping up of data and methods into a single unit (called class) is known as encapsulation. • Data encapsulation is the most striking feature of a class. The data is not accessible to' the outside world and only those methods, which are wrapped in the class, can access it. These methods provide the interface between the object's data and the program. • i.e. mixed of several medicines. A java class is the example of encapsulation. • This insulation of the data from direct access by 'the program is called data hiding.
  • 20. Message Communication: • 1. Creating classes that define objects and their behaviour. • 2. Creating objects from class definitions. • 3. Establishing communication among objects.
  • 21.
  • 22. Dynamic Binding • Dynamic binding means that the code associated with a given procedure call is not known until the time of the call at runtime.
  • 23. DIFFERENCE BETWEEN PROCEDURE-ORIENTED AND OBJECT-ORIENTED PROGRAMMING
  • 24. JAVA • Java is a robust, general-purpose, high-level programming language and a powerful software platform. It is also object-oriented, distributed, portable and multi-threaded. Java follows the 'Write - once - run - anywhere' approach. • All Java programs must run on the Java platform that has two components, i. Java Virtual Machine (JVM) Ii.Java Application Programming Interface (API). • With Java API, many types of Java programs can be developed. These include Java stand-alone applications Java Applets Java Servlets
  • 25.
  • 26. Characteristics of Java language • Compiled and Interpreted • Platform-Independent and Portable • Object-Oriented • Robust and Secure • Distributed • Familiar, Simple. and Small • Multithreaded and Interactive • High Performance • Dynamic and Extensible
  • 28. STRUCTURE OF JAVA PROGRAM A Java program involves the following sections: • Documentation Section • Package Statement • Import Statements • Interface Statement • Class Definition • Main Method Class • Main Method Definition
  • 29. COMPILATION AND EXECUTION OF A JAVA PROGRAMCompilation • First, the source .java‘ file is passed through the compiler, which then encodes the source code into a machine independent encoding, known as Bytecode. The content of each class contained in the source file is stored in a separate .class‘ file. Execution • The class files generated by the compiler are independent of the machine or the OS, which allows them to be run on any system. To run, the main class file (the class that contains the method main) is passed to the JVM, and then goes through three main stages before the final machine code is executed. These stages are: a. Class Loader b.Bytecode Verifier c.Just-In-Time Compiler
  • 30.
  • 31. FUNDAMENTAL PROGRAMMING STRUCTURES IN JAVA • COMMENTS – System.out.println("Hello, World!"); // comment – /* and */ – /** to start and a */ to end public class JavaApplication1 { public static void main(String[] args) { System.out.println("welcome"); } }
  • 32. DATA TYPES 1) Integers • Java defines four integer types: byte, short, int, and long.
  • 33.
  • 34. 2. Floating-Point Types 3. Characters It is a unification of dozens of character sets, such as Latin, Greek, Arabic, Cyrillic, Hebrew, Katakana, Hangul, and many more. For this purpose, it requires 16 bits. Thus, in Java char is a 16-bit type. The range of a char is 0 to 65,536. Although char is designed to hold Unicode characters, it can also be thought of as an integer type on which you can perform arithmetic operations 4. Booleans
  • 35. Literals • 1. Integer Literals • 2. Floating-Point Literals • 3. Boolean Literals • 4. Character Literals • 5. String Literals
  • 36. VARIABLES• The variable is the basic unit of storage in a Java program. • Declaring a Variable type identifier [ = value][, identifier [= value] ...] ; • int a, b, c; // declares three ints, a, b, and c. • int d = 3, e, f = 5; // declares three more ints, initializing // d and f. Dynamic Initialization: double c = Math.sqrt(a * a + b * b); The Scope and Lifetime of Variables There are two general categories of scopes: • global and • local Type Conversion and Casting -int value to a long variable Casting Incompatible Types int a; byte b; // ... b = (byte) a;
  • 38. • 2. The Bitwise Operators
  • 39. • 3. Relational Operators
  • 40. • 4. Boolean Logical Operators • 5. Short-Circuit Logical Operators
  • 41. • 6. The Assignment Operator: • 7. The ? Operator – General form: – expression1 ? expression2 : expression3
  • 42. CONTROL STATEMENTS Java‘s program control statements can be put into the following categories: • Selection statements • Iteration statements • Jump statements
  • 43. 1. Selection statements Java supports two selection statements: • if • switch
  • 44. 2. Iteration Statements Java‘s iteration statements are • for for(initialization; condition; iteration) { // body } • do-while