SlideShare a Scribd company logo
1 of 12
Presented by
MD. TOFAZZAL HOSSAIN
ID NO: 163015003
Department: CSE (Weekend)
 A collection of statements that are grouped together to
perform an operation.
 A method has the following syntax
modifier return_Value_Type Method Name(list of
parameters)
{ // Method body; }
 A method definition consists of a method header and a
method body
Method Name
•The actual name of the method.
•Method name and the parameter list together
constitute the method signature.
Parameters
•This value is referred to as actual parameter or
argument.
•The parameter list refers to the type, order, and
number of the parameters of a method.
Method Body
The method body contains a collection of statements that
define what the method does.
 A concept in Java which allows programmer to
declare method with same name but different
behavior.
 Method with same name co-exists in same class but
they must have different method.
 If you have two methods with same name in
one Java class with different method.
 Generally overloaded method in Java has different
set of arguments to perform something based on
different.
public class MethodOverLoading
{
// Method 1
public static int Addition(int a, int b)
{
System.out.println(“Method 1 is called”);
return a + b;
}
// Method 2
public static int Addition(int a, int b, int c)
{
System.out.println(“Method 2 is called”);
return a + b + c;
}
}
public static void main(String[] args)
{
int Answer1 = Addition(5, 6);
// In this case Method 1 will be called
System.out.println(“Answer 1 = ” + Answer1);
int Answer2 = Addition(5, 6, 7);
// In this case Method 2 will be called
System.out.println(“Answer 2 = ” + Answer2);
}
Method 1 is called
Answer 1 = 11
----------------------------
Method 2 is called
Answer 2 = 18
THANKS
TO
ALL

More Related Content

What's hot

Basics of java 2
Basics of java 2Basics of java 2
Basics of java 2
Raghu nath
 
Mutable and immutable classes
Mutable and  immutable classesMutable and  immutable classes
Mutable and immutable classes
Tech_MX
 
Generics Collections
Generics CollectionsGenerics Collections
Generics Collections
phanleson
 

What's hot (19)

Keyword of java
Keyword of javaKeyword of java
Keyword of java
 
Python dictionary
Python dictionaryPython dictionary
Python dictionary
 
Binary search
Binary searchBinary search
Binary search
 
Python Dictionary
Python DictionaryPython Dictionary
Python Dictionary
 
Basics of java 2
Basics of java 2Basics of java 2
Basics of java 2
 
Method overloading
Method overloadingMethod overloading
Method overloading
 
Mutable and immutable classes
Mutable and  immutable classesMutable and  immutable classes
Mutable and immutable classes
 
Introduction to php oop
Introduction to php oopIntroduction to php oop
Introduction to php oop
 
Class template
Class templateClass template
Class template
 
Introduction to method overloading & method overriding in java hdm
Introduction to method overloading & method overriding  in java  hdmIntroduction to method overloading & method overriding  in java  hdm
Introduction to method overloading & method overriding in java hdm
 
Method Overloading In Java
Method Overloading In JavaMethod Overloading In Java
Method Overloading In Java
 
Collections - Sorting, Comparing Basics
Collections - Sorting, Comparing BasicsCollections - Sorting, Comparing Basics
Collections - Sorting, Comparing Basics
 
Lab report format
Lab report formatLab report format
Lab report format
 
Indexers in C#
Indexers in C#Indexers in C#
Indexers in C#
 
Array
ArrayArray
Array
 
Intro to t sql – 3rd session
Intro to t sql – 3rd sessionIntro to t sql – 3rd session
Intro to t sql – 3rd session
 
Objects and Types C#
Objects and Types C#Objects and Types C#
Objects and Types C#
 
Basic concept of class, method , command line-argument
Basic concept of class, method , command line-argumentBasic concept of class, method , command line-argument
Basic concept of class, method , command line-argument
 
Generics Collections
Generics CollectionsGenerics Collections
Generics Collections
 

Similar to Object oriented programming.

chap 6 : Objects and classes (scjp/ocjp)
chap 6 : Objects and classes (scjp/ocjp)chap 6 : Objects and classes (scjp/ocjp)
chap 6 : Objects and classes (scjp/ocjp)
It Academy
 
Ap Power Point Chpt5
Ap Power Point Chpt5Ap Power Point Chpt5
Ap Power Point Chpt5
dplunkett
 
Chapter 4 Absolute Java
Chapter 4 Absolute Java Chapter 4 Absolute Java
Chapter 4 Absolute Java
Shariq Alee
 
Ap Power Point Chpt6
Ap Power Point Chpt6Ap Power Point Chpt6
Ap Power Point Chpt6
dplunkett
 

Similar to Object oriented programming. (20)

Java As an OOP Language,Exception Handling & Applets
Java As an OOP Language,Exception Handling & AppletsJava As an OOP Language,Exception Handling & Applets
Java As an OOP Language,Exception Handling & Applets
 
chap 6 : Objects and classes (scjp/ocjp)
chap 6 : Objects and classes (scjp/ocjp)chap 6 : Objects and classes (scjp/ocjp)
chap 6 : Objects and classes (scjp/ocjp)
 
Java defining classes
Java defining classes Java defining classes
Java defining classes
 
Android Training (Java Review)
Android Training (Java Review)Android Training (Java Review)
Android Training (Java Review)
 
Oop in kotlin
Oop in kotlinOop in kotlin
Oop in kotlin
 
Java Basics
Java BasicsJava Basics
Java Basics
 
LISP: Object Sytstem Lisp
LISP: Object Sytstem LispLISP: Object Sytstem Lisp
LISP: Object Sytstem Lisp
 
PHP Cheat Sheet
PHP Cheat SheetPHP Cheat Sheet
PHP Cheat Sheet
 
JAVA_1.pptx
JAVA_1.pptxJAVA_1.pptx
JAVA_1.pptx
 
Ap Power Point Chpt5
Ap Power Point Chpt5Ap Power Point Chpt5
Ap Power Point Chpt5
 
PHP-Cheat-Sheet.pdf
PHP-Cheat-Sheet.pdfPHP-Cheat-Sheet.pdf
PHP-Cheat-Sheet.pdf
 
Ch-2ppt.pptx
Ch-2ppt.pptxCh-2ppt.pptx
Ch-2ppt.pptx
 
JAVA METHOD AND FUNCTION DIVIDE AND SHORT.pptx
JAVA METHOD AND FUNCTION DIVIDE AND SHORT.pptxJAVA METHOD AND FUNCTION DIVIDE AND SHORT.pptx
JAVA METHOD AND FUNCTION DIVIDE AND SHORT.pptx
 
Chapter 4 Absolute Java
Chapter 4 Absolute Java Chapter 4 Absolute Java
Chapter 4 Absolute Java
 
Chap4java5th
Chap4java5thChap4java5th
Chap4java5th
 
Overloading and overriding in vb.net
Overloading and overriding in vb.netOverloading and overriding in vb.net
Overloading and overriding in vb.net
 
EContent_11_2023_04_09_11_30_38_Unit_3_Objects_and_Classespptx__2023_03_20_12...
EContent_11_2023_04_09_11_30_38_Unit_3_Objects_and_Classespptx__2023_03_20_12...EContent_11_2023_04_09_11_30_38_Unit_3_Objects_and_Classespptx__2023_03_20_12...
EContent_11_2023_04_09_11_30_38_Unit_3_Objects_and_Classespptx__2023_03_20_12...
 
4. java intro class
4. java intro class4. java intro class
4. java intro class
 
Class 10
Class 10Class 10
Class 10
 
Ap Power Point Chpt6
Ap Power Point Chpt6Ap Power Point Chpt6
Ap Power Point Chpt6
 

Recently uploaded

Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
Kamal Acharya
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
HenryBriggs2
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
Epec Engineered Technologies
 
Introduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptxIntroduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptx
hublikarsn
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
mphochane1998
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
Neometrix_Engineering_Pvt_Ltd
 

Recently uploaded (20)

Worksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptxWorksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptx
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Post office management system project ..pdf
Post office management system project ..pdfPost office management system project ..pdf
Post office management system project ..pdf
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
 
Ground Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementGround Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth Reinforcement
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
Introduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdfIntroduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdf
 
Path loss model, OKUMURA Model, Hata Model
Path loss model, OKUMURA Model, Hata ModelPath loss model, OKUMURA Model, Hata Model
Path loss model, OKUMURA Model, Hata Model
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
Introduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptxIntroduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptx
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
 
Signal Processing and Linear System Analysis
Signal Processing and Linear System AnalysisSignal Processing and Linear System Analysis
Signal Processing and Linear System Analysis
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 

Object oriented programming.

  • 1. Presented by MD. TOFAZZAL HOSSAIN ID NO: 163015003 Department: CSE (Weekend)
  • 2.
  • 3.
  • 4.  A collection of statements that are grouped together to perform an operation.  A method has the following syntax modifier return_Value_Type Method Name(list of parameters) { // Method body; }  A method definition consists of a method header and a method body
  • 5. Method Name •The actual name of the method. •Method name and the parameter list together constitute the method signature. Parameters •This value is referred to as actual parameter or argument. •The parameter list refers to the type, order, and number of the parameters of a method.
  • 6. Method Body The method body contains a collection of statements that define what the method does.
  • 7.  A concept in Java which allows programmer to declare method with same name but different behavior.  Method with same name co-exists in same class but they must have different method.
  • 8.  If you have two methods with same name in one Java class with different method.  Generally overloaded method in Java has different set of arguments to perform something based on different.
  • 9. public class MethodOverLoading { // Method 1 public static int Addition(int a, int b) { System.out.println(“Method 1 is called”); return a + b; } // Method 2 public static int Addition(int a, int b, int c) { System.out.println(“Method 2 is called”); return a + b + c; } }
  • 10. public static void main(String[] args) { int Answer1 = Addition(5, 6); // In this case Method 1 will be called System.out.println(“Answer 1 = ” + Answer1); int Answer2 = Addition(5, 6, 7); // In this case Method 2 will be called System.out.println(“Answer 2 = ” + Answer2); }
  • 11. Method 1 is called Answer 1 = 11 ---------------------------- Method 2 is called Answer 2 = 18