SlideShare a Scribd company logo
INTRODUCTION TO OOP AND
JAVA FUNDAMENTALS
N.ANSGAR MARY
AP/IT
Introduction to oop and java fundamentals
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
Introduction to oop and java fundamentals
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.
Introduction to oop and java fundamentals
Introduction to oop and java fundamentals
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. } }
Introduction to oop and java fundamentals
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.
Introduction to oop and java fundamentals
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.
Introduction to oop and java fundamentals
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
Introduction to oop and java fundamentals
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
Introduction to oop and java fundamentals
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.
Introduction to oop and java fundamentals
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
Ad

More Related Content

What's hot (20)

Introduction to oop
Introduction to oop Introduction to oop
Introduction to oop
Kumar
 
Object Oriented Programming with Java
Object Oriented Programming with JavaObject Oriented Programming with Java
Object Oriented Programming with Java
backdoor
 
Functions in c++
Functions in c++Functions in c++
Functions in c++
Rokonuzzaman Rony
 
Datatype in JavaScript
Datatype in JavaScriptDatatype in JavaScript
Datatype in JavaScript
Rajat Saxena
 
Strings in C
Strings in CStrings in C
Strings in C
Kamal Acharya
 
Method overloading
Method overloadingMethod overloading
Method overloading
Lovely Professional University
 
Querying XML: XPath and XQuery
Querying XML: XPath and XQueryQuerying XML: XPath and XQuery
Querying XML: XPath and XQuery
Katrien Verbert
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
Nadeesha Thilakarathne
 
Object Oriented Programming using C++(UNIT 1)
Object Oriented Programming using C++(UNIT 1)Object Oriented Programming using C++(UNIT 1)
Object Oriented Programming using C++(UNIT 1)
Dr. SURBHI SAROHA
 
Classes and Objects
Classes and Objects  Classes and Objects
Classes and Objects
yndaravind
 
Lecture_7-Encapsulation in Java.pptx
Lecture_7-Encapsulation in Java.pptxLecture_7-Encapsulation in Java.pptx
Lecture_7-Encapsulation in Java.pptx
ShahinAhmed49
 
Oops
OopsOops
Oops
Sankar Balasubramanian
 
Oops concepts || Object Oriented Programming Concepts in Java
Oops concepts || Object Oriented Programming Concepts in JavaOops concepts || Object Oriented Programming Concepts in Java
Oops concepts || Object Oriented Programming Concepts in Java
Madishetty Prathibha
 
Form Validation in JavaScript
Form Validation in JavaScriptForm Validation in JavaScript
Form Validation in JavaScript
Ravi Bhadauria
 
Classes in c++ (OOP Presentation)
Classes in c++ (OOP Presentation)Classes in c++ (OOP Presentation)
Classes in c++ (OOP Presentation)
Majid Saeed
 
1 unit (oops)
1 unit (oops)1 unit (oops)
1 unit (oops)
Jay Patel
 
concept of oops
concept of oopsconcept of oops
concept of oops
prince sharma
 
jQuery
jQueryjQuery
jQuery
Jay Poojara
 
Method Overloading in Java
Method Overloading in JavaMethod Overloading in Java
Method Overloading in Java
Sonya Akter Rupa
 
JDBC – Java Database Connectivity
JDBC – Java Database ConnectivityJDBC – Java Database Connectivity
JDBC – Java Database Connectivity
Information Technology
 
Introduction to oop
Introduction to oop Introduction to oop
Introduction to oop
Kumar
 
Object Oriented Programming with Java
Object Oriented Programming with JavaObject Oriented Programming with Java
Object Oriented Programming with Java
backdoor
 
Datatype in JavaScript
Datatype in JavaScriptDatatype in JavaScript
Datatype in JavaScript
Rajat Saxena
 
Querying XML: XPath and XQuery
Querying XML: XPath and XQueryQuerying XML: XPath and XQuery
Querying XML: XPath and XQuery
Katrien Verbert
 
Object Oriented Programming using C++(UNIT 1)
Object Oriented Programming using C++(UNIT 1)Object Oriented Programming using C++(UNIT 1)
Object Oriented Programming using C++(UNIT 1)
Dr. SURBHI SAROHA
 
Classes and Objects
Classes and Objects  Classes and Objects
Classes and Objects
yndaravind
 
Lecture_7-Encapsulation in Java.pptx
Lecture_7-Encapsulation in Java.pptxLecture_7-Encapsulation in Java.pptx
Lecture_7-Encapsulation in Java.pptx
ShahinAhmed49
 
Oops concepts || Object Oriented Programming Concepts in Java
Oops concepts || Object Oriented Programming Concepts in JavaOops concepts || Object Oriented Programming Concepts in Java
Oops concepts || Object Oriented Programming Concepts in Java
Madishetty Prathibha
 
Form Validation in JavaScript
Form Validation in JavaScriptForm Validation in JavaScript
Form Validation in JavaScript
Ravi Bhadauria
 
Classes in c++ (OOP Presentation)
Classes in c++ (OOP Presentation)Classes in c++ (OOP Presentation)
Classes in c++ (OOP Presentation)
Majid Saeed
 
1 unit (oops)
1 unit (oops)1 unit (oops)
1 unit (oops)
Jay Patel
 
Method Overloading in Java
Method Overloading in JavaMethod Overloading in Java
Method Overloading in Java
Sonya Akter Rupa
 

Similar to Introduction to oop and java fundamentals (20)

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
CS8392 OOP
DhanalakshmiVelusamy1
 
oop unit1.pptx
oop unit1.pptxoop unit1.pptx
oop unit1.pptx
sureshkumara29
 
Java_notes.ppt
Java_notes.pptJava_notes.ppt
Java_notes.ppt
tuyambazejeanclaude
 
Presentation2.ppt java basic core ppt .
Presentation2.ppt  java basic core ppt .Presentation2.ppt  java basic core ppt .
Presentation2.ppt java basic core ppt .
KeshavMotivation
 
Java Fundamentalojhgghjjjjhhgghhjjjjhhj.ppt
Java Fundamentalojhgghjjjjhhgghhjjjjhhj.pptJava Fundamentalojhgghjjjjhhgghhjjjjhhj.ppt
Java Fundamentalojhgghjjjjhhgghhjjjjhhj.ppt
akashsachu221
 
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 Simple Introduction in single course
Java Simple Introduction in single courseJava Simple Introduction in single course
Java Simple Introduction in single course
binzbinz3
 
java01.pptbvuyvyuvvvvvvvvvvvvvvvvvvvvyft
java01.pptbvuyvyuvvvvvvvvvvvvvvvvvvvvyftjava01.pptbvuyvyuvvvvvvvvvvvvvvvvvvvvyft
java01.pptbvuyvyuvvvvvvvvvvvvvvvvvvvvyft
nagendrareddy104104
 
Java
JavaJava
Java
Manav Prasad
 
java-corporate-training-institute-in-mumbai
java-corporate-training-institute-in-mumbaijava-corporate-training-institute-in-mumbai
java-corporate-training-institute-in-mumbai
vibrantuser
 
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
 
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
 
OOPS (Object Oriented Programming System) CONCEPTS
OOPS (Object Oriented Programming System) CONCEPTSOOPS (Object Oriented Programming System) CONCEPTS
OOPS (Object Oriented Programming System) CONCEPTS
HariShiva7
 
Lectupopplkmkmkkpompom-0ookoimmire 2.pdf
Lectupopplkmkmkkpompom-0ookoimmire 2.pdfLectupopplkmkmkkpompom-0ookoimmire 2.pdf
Lectupopplkmkmkkpompom-0ookoimmire 2.pdf
rtreduanur247
 
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
 
Presentation2.ppt java basic core ppt .
Presentation2.ppt  java basic core ppt .Presentation2.ppt  java basic core ppt .
Presentation2.ppt java basic core ppt .
KeshavMotivation
 
Java Fundamentalojhgghjjjjhhgghhjjjjhhj.ppt
Java Fundamentalojhgghjjjjhhgghhjjjjhhj.pptJava Fundamentalojhgghjjjjhhgghhjjjjhhj.ppt
Java Fundamentalojhgghjjjjhhgghhjjjjhhj.ppt
akashsachu221
 
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
 
Core java lessons
Core java lessonsCore java lessons
Core java lessons
vivek shah
 
Java Simple Introduction in single course
Java Simple Introduction in single courseJava Simple Introduction in single course
Java Simple Introduction in single course
binzbinz3
 
java01.pptbvuyvyuvvvvvvvvvvvvvvvvvvvvyft
java01.pptbvuyvyuvvvvvvvvvvvvvvvvvvvvyftjava01.pptbvuyvyuvvvvvvvvvvvvvvvvvvvvyft
java01.pptbvuyvyuvvvvvvvvvvvvvvvvvvvvyft
nagendrareddy104104
 
java-corporate-training-institute-in-mumbai
java-corporate-training-institute-in-mumbaijava-corporate-training-institute-in-mumbai
java-corporate-training-institute-in-mumbai
vibrantuser
 
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
 
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
 
OOPS (Object Oriented Programming System) CONCEPTS
OOPS (Object Oriented Programming System) CONCEPTSOOPS (Object Oriented Programming System) CONCEPTS
OOPS (Object Oriented Programming System) CONCEPTS
HariShiva7
 
Lectupopplkmkmkkpompom-0ookoimmire 2.pdf
Lectupopplkmkmkkpompom-0ookoimmire 2.pdfLectupopplkmkmkkpompom-0ookoimmire 2.pdf
Lectupopplkmkmkkpompom-0ookoimmire 2.pdf
rtreduanur247
 
Ad

Recently uploaded (20)

How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
Adobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest VersionAdobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest Version
kashifyounis067
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
Salesforce Aged Complex Org Revitalization Process .pdf
Salesforce Aged Complex Org Revitalization Process .pdfSalesforce Aged Complex Org Revitalization Process .pdf
Salesforce Aged Complex Org Revitalization Process .pdf
SRINIVASARAO PUSULURI
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
Maxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINKMaxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINK
younisnoman75
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
Adobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest VersionAdobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest Version
kashifyounis067
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
Salesforce Aged Complex Org Revitalization Process .pdf
Salesforce Aged Complex Org Revitalization Process .pdfSalesforce Aged Complex Org Revitalization Process .pdf
Salesforce Aged Complex Org Revitalization Process .pdf
SRINIVASARAO PUSULURI
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
Maxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINKMaxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINK
younisnoman75
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
Ad

Introduction to oop and java fundamentals

  • 1. INTRODUCTION TO OOP AND JAVA FUNDAMENTALS N.ANSGAR MARY AP/IT
  • 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
  • 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.
  • 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. } }
  • 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.
  • 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.
  • 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
  • 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
  • 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.
  • 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