SlideShare una empresa de Scribd logo
1 de 12
Disclaimer: This presentation is prepared by trainees of
baabtra as a part of mentoring program. This is not official
document of baabtra –Mentoring Partner
Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt .
Ltd
Typing Speed
Week

Target Achieved

1

40

21

2

40

23

3

40

27
Jobs Applied
Week

Company

Designation

Applied Date

Current Status

1

Advent
software

Sr. Application Engineer

28-8-2013

Short listed

2

Alcatel-lucent

Software Engineer

30-8-2013

Waiting

3

Intel info group System Engineer

6-9-2013

Waiting
Method overloading and constructor overloading
in JAVA
Muhammed Noufal V T
muhammednoufalvt@gmail.com
www.facebook.com/vtnoufalvt
twitter.com/noufalurnappy
in.linkedin.com/pub/muhammed-noufal
9744003056
What is Method
• A Java method is a collection of statements that are grouped
together to perform an operation
• A class can contain any number of methods.
• Methods can be with parameter and without parameter.
• The parameter in a method are called type signature.
Method Overloading
• Two or more methods within the same class that share the same
name, but with different parameter declarations (type signatures).
• The process is referred to as method overloading.
• Overloading methods demonstrate the concept of polymorphism.
• Overloaded methods may have different return types.
• When java encounters a call to an overloaded method, it simply executes the
version of the method whose parameters match the arguments used in the
call.
Example
•
{

public class example_1

void square(int p1, int p2)
int n1;
int n2;
example_1()
{
n1 = 10;
n2 = 20;
}
void square()
{
System.out.println("The Square is " + n1 * n2);
}
void square(int p1)
{
n1 = p1;
System.out.println("The Square is " + n1 *
n2);
}

{
n1 = p1;
n2 = p2;
System.out.println("The Square is " +
n1 * n2);
}
public static void main(String args[])
{
example_1 obj1 = new example_1();
obj1.square();
obj1.square(4);
obj1.square(7,8);
}
}
Constructor
•
•
•
•

Special type of method
A constructor initialize an object immediately upon creation
Name of constructor must be same as name of Class
Once defined, the constructor is automatically called immediately after
the object is created before the new operator compleates
• They do not specify any return type not even void
Constructor Overloading
• Constructors are methods that can be overloaded, just like any
other method in a class.
• Constructors having the same name with different parameter
list is called constructor overloading.
class Point
{
int x;
int y;
Point(int a, int b)
{
x = a;
y = b;
}}
class Circle
{
int originX;
int originY;
int radius;
Circle()
{
originX = 5;
originY = 5;
radius = 3;
}
Circle(int x1, int y1, int r)
{
originX = x1;
originY = y1;
radius = r;
}

Example

Circle(Point p, int r)
{
originX = p.x;
originY = p.y;
radius = r;
}
void display()
{
System.out.println("--Center at " + originX
+ " and " + originY);
System.out.println("Radius = " + radius);
}
public static void main(String args[])
{
Circle c1 = new Circle();
Circle c2 = new Circle(10,20,5);
Circle c3 = new Circle(new Point(15,25),10);
c1.display();
c2.display();
c3.display();
}}
Contact Us
Emarald Mall (Big Bazar Building)
Mavoor Road, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550

Start up Village
Eranakulam,
Kerala, India.
Email: info@baabtra.com

NC Complex, Near Bus Stand
Mukkam, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550

Más contenido relacionado

La actualidad más candente

Class and Objects in Java
Class and Objects in JavaClass and Objects in Java
Class and Objects in JavaSpotle.ai
 
Evolving role of Software,Legacy software,CASE tools,Process Models,CMMI
Evolving role of Software,Legacy software,CASE tools,Process Models,CMMIEvolving role of Software,Legacy software,CASE tools,Process Models,CMMI
Evolving role of Software,Legacy software,CASE tools,Process Models,CMMInimmik4u
 
Inheritance in java
Inheritance in java Inheritance in java
Inheritance in java yash jain
 
Java exception handling
Java exception handlingJava exception handling
Java exception handlingBHUVIJAYAVELU
 
Rational Unified Process
Rational Unified ProcessRational Unified Process
Rational Unified ProcessKumar
 
Java abstract class & abstract methods
Java abstract class & abstract methodsJava abstract class & abstract methods
Java abstract class & abstract methodsShubham Dwivedi
 
Java non access modifiers
Java non access modifiersJava non access modifiers
Java non access modifiersSrinivas Reddy
 
Python Exception Handling
Python Exception HandlingPython Exception Handling
Python Exception HandlingMegha V
 
Online Quiz System Project Report ppt
Online Quiz System Project Report pptOnline Quiz System Project Report ppt
Online Quiz System Project Report pptKishan Maurya
 
Waterfall model ppt final
Waterfall model ppt  finalWaterfall model ppt  final
Waterfall model ppt finalshiva krishna
 

La actualidad más candente (20)

Spiral model
Spiral modelSpiral model
Spiral model
 
Class and Objects in Java
Class and Objects in JavaClass and Objects in Java
Class and Objects in Java
 
Evolving role of Software,Legacy software,CASE tools,Process Models,CMMI
Evolving role of Software,Legacy software,CASE tools,Process Models,CMMIEvolving role of Software,Legacy software,CASE tools,Process Models,CMMI
Evolving role of Software,Legacy software,CASE tools,Process Models,CMMI
 
Applets
AppletsApplets
Applets
 
Arrays in Java
Arrays in JavaArrays in Java
Arrays in Java
 
Inheritance in java
Inheritance in java Inheritance in java
Inheritance in java
 
Java exception handling
Java exception handlingJava exception handling
Java exception handling
 
Constructor ppt
Constructor pptConstructor ppt
Constructor ppt
 
Rational Unified Process
Rational Unified ProcessRational Unified Process
Rational Unified Process
 
Java API
Java APIJava API
Java API
 
Final keyword in java
Final keyword in javaFinal keyword in java
Final keyword in java
 
Delegates and events in C#
Delegates and events in C#Delegates and events in C#
Delegates and events in C#
 
Java abstract class & abstract methods
Java abstract class & abstract methodsJava abstract class & abstract methods
Java abstract class & abstract methods
 
Java non access modifiers
Java non access modifiersJava non access modifiers
Java non access modifiers
 
Python Exception Handling
Python Exception HandlingPython Exception Handling
Python Exception Handling
 
SQLite database in android
SQLite database in androidSQLite database in android
SQLite database in android
 
Online Quiz System Project Report ppt
Online Quiz System Project Report pptOnline Quiz System Project Report ppt
Online Quiz System Project Report ppt
 
Features of java
Features of javaFeatures of java
Features of java
 
Java I/o streams
Java I/o streamsJava I/o streams
Java I/o streams
 
Waterfall model ppt final
Waterfall model ppt  finalWaterfall model ppt  final
Waterfall model ppt final
 

Destacado

Exception Handling
Exception HandlingException Handling
Exception HandlingReddhi Basu
 
encapsulation, inheritance, overriding, overloading
encapsulation, inheritance, overriding, overloadingencapsulation, inheritance, overriding, overloading
encapsulation, inheritance, overriding, overloadingShivam Singhal
 
2CPP08 - Overloading and Overriding
2CPP08 - Overloading and Overriding2CPP08 - Overloading and Overriding
2CPP08 - Overloading and OverridingMichael Heron
 
Seminar on polymorphism
Seminar on polymorphismSeminar on polymorphism
Seminar on polymorphism023henil
 

Destacado (11)

Polymorphism
PolymorphismPolymorphism
Polymorphism
 
Exception handling
Exception handlingException handling
Exception handling
 
Exception Handling
Exception HandlingException Handling
Exception Handling
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
encapsulation, inheritance, overriding, overloading
encapsulation, inheritance, overriding, overloadingencapsulation, inheritance, overriding, overloading
encapsulation, inheritance, overriding, overloading
 
2CPP08 - Overloading and Overriding
2CPP08 - Overloading and Overriding2CPP08 - Overloading and Overriding
2CPP08 - Overloading and Overriding
 
Seminar on polymorphism
Seminar on polymorphismSeminar on polymorphism
Seminar on polymorphism
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
polymorphism
polymorphism polymorphism
polymorphism
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 

Similar a Method overloading and constructor overloading in java

Constructor destructor.ppt
Constructor destructor.pptConstructor destructor.ppt
Constructor destructor.pptKarthik Sekar
 
Object Oriented Programming Constructors & Destructors
Object Oriented Programming  Constructors &  DestructorsObject Oriented Programming  Constructors &  Destructors
Object Oriented Programming Constructors & Destructorsanitashinde33
 
METHODS IN JAVA.ppt
METHODS IN  JAVA.pptMETHODS IN  JAVA.ppt
METHODS IN JAVA.pptJayanthiM15
 
CJP Unit-1 contd.pptx
CJP Unit-1 contd.pptxCJP Unit-1 contd.pptx
CJP Unit-1 contd.pptxRAJASEKHARV10
 
Object Oriented Programming Concepts using Java
Object Oriented Programming Concepts using JavaObject Oriented Programming Concepts using Java
Object Oriented Programming Concepts using JavaGlenn Guden
 
UNIT - IIInew.pptx
UNIT - IIInew.pptxUNIT - IIInew.pptx
UNIT - IIInew.pptxakila m
 
Structures and Pointers
Structures and PointersStructures and Pointers
Structures and PointersPrabu U
 
OOPS in java | Super and this Keyword | Memory Management in java | pacakages...
OOPS in java | Super and this Keyword | Memory Management in java | pacakages...OOPS in java | Super and this Keyword | Memory Management in java | pacakages...
OOPS in java | Super and this Keyword | Memory Management in java | pacakages...Sagar Verma
 
02._Object-Oriented_Programming_Concepts.ppt
02._Object-Oriented_Programming_Concepts.ppt02._Object-Oriented_Programming_Concepts.ppt
02._Object-Oriented_Programming_Concepts.pptYonas D. Ebren
 
java: basics, user input, data type, constructor
java:  basics, user input, data type, constructorjava:  basics, user input, data type, constructor
java: basics, user input, data type, constructorShivam Singhal
 
4CS4-25-Java-Lab-Manual.pdf
4CS4-25-Java-Lab-Manual.pdf4CS4-25-Java-Lab-Manual.pdf
4CS4-25-Java-Lab-Manual.pdfamitbhachne
 

Similar a Method overloading and constructor overloading in java (20)

Methods and constructors in java
Methods and constructors in javaMethods and constructors in java
Methods and constructors in java
 
Constructor destructor.ppt
Constructor destructor.pptConstructor destructor.ppt
Constructor destructor.ppt
 
Object Oriented Programming Constructors & Destructors
Object Oriented Programming  Constructors &  DestructorsObject Oriented Programming  Constructors &  Destructors
Object Oriented Programming Constructors & Destructors
 
Overloadingmethod
OverloadingmethodOverloadingmethod
Overloadingmethod
 
METHODS IN JAVA.ppt
METHODS IN  JAVA.pptMETHODS IN  JAVA.ppt
METHODS IN JAVA.ppt
 
C# classes objects
C#  classes objectsC#  classes objects
C# classes objects
 
17515
1751517515
17515
 
CJP Unit-1 contd.pptx
CJP Unit-1 contd.pptxCJP Unit-1 contd.pptx
CJP Unit-1 contd.pptx
 
Basics of Java
Basics of JavaBasics of Java
Basics of Java
 
Object Oriented Programming Concepts using Java
Object Oriented Programming Concepts using JavaObject Oriented Programming Concepts using Java
Object Oriented Programming Concepts using Java
 
Java Programming - 04 object oriented in java
Java Programming - 04 object oriented in javaJava Programming - 04 object oriented in java
Java Programming - 04 object oriented in java
 
Functions in javascript
Functions in javascriptFunctions in javascript
Functions in javascript
 
UNIT - IIInew.pptx
UNIT - IIInew.pptxUNIT - IIInew.pptx
UNIT - IIInew.pptx
 
Structures and Pointers
Structures and PointersStructures and Pointers
Structures and Pointers
 
OOPS in java | Super and this Keyword | Memory Management in java | pacakages...
OOPS in java | Super and this Keyword | Memory Management in java | pacakages...OOPS in java | Super and this Keyword | Memory Management in java | pacakages...
OOPS in java | Super and this Keyword | Memory Management in java | pacakages...
 
02._Object-Oriented_Programming_Concepts.ppt
02._Object-Oriented_Programming_Concepts.ppt02._Object-Oriented_Programming_Concepts.ppt
02._Object-Oriented_Programming_Concepts.ppt
 
C#2
C#2C#2
C#2
 
java: basics, user input, data type, constructor
java:  basics, user input, data type, constructorjava:  basics, user input, data type, constructor
java: basics, user input, data type, constructor
 
4CS4-25-Java-Lab-Manual.pdf
4CS4-25-Java-Lab-Manual.pdf4CS4-25-Java-Lab-Manual.pdf
4CS4-25-Java-Lab-Manual.pdf
 
Unit ii
Unit iiUnit ii
Unit ii
 

Más de baabtra.com - No. 1 supplier of quality freshers

Más de baabtra.com - No. 1 supplier of quality freshers (20)

Agile methodology and scrum development
Agile methodology and scrum developmentAgile methodology and scrum development
Agile methodology and scrum development
 
Best coding practices
Best coding practicesBest coding practices
Best coding practices
 
Core java - baabtra
Core java - baabtraCore java - baabtra
Core java - baabtra
 
Acquiring new skills what you should know
Acquiring new skills   what you should knowAcquiring new skills   what you should know
Acquiring new skills what you should know
 
Baabtra.com programming at school
Baabtra.com programming at schoolBaabtra.com programming at school
Baabtra.com programming at school
 
99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love 99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love
 
Php sessions & cookies
Php sessions & cookiesPhp sessions & cookies
Php sessions & cookies
 
Php database connectivity
Php database connectivityPhp database connectivity
Php database connectivity
 
Chapter 6 database normalisation
Chapter 6  database normalisationChapter 6  database normalisation
Chapter 6 database normalisation
 
Chapter 5 transactions and dcl statements
Chapter 5  transactions and dcl statementsChapter 5  transactions and dcl statements
Chapter 5 transactions and dcl statements
 
Chapter 4 functions, views, indexing
Chapter 4  functions, views, indexingChapter 4  functions, views, indexing
Chapter 4 functions, views, indexing
 
Chapter 3 stored procedures
Chapter 3 stored proceduresChapter 3 stored procedures
Chapter 3 stored procedures
 
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 2  grouping,scalar and aggergate functions,joins   inner join,outer joinChapter 2  grouping,scalar and aggergate functions,joins   inner join,outer join
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Microsoft holo lens
Microsoft holo lensMicrosoft holo lens
Microsoft holo lens
 
Blue brain
Blue brainBlue brain
Blue brain
 
5g
5g5g
5g
 
Aptitude skills baabtra
Aptitude skills baabtraAptitude skills baabtra
Aptitude skills baabtra
 
Gd baabtra
Gd baabtraGd baabtra
Gd baabtra
 

Último

MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationRosabel UA
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 

Último (20)

MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 

Method overloading and constructor overloading in java

  • 1.
  • 2. Disclaimer: This presentation is prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra –Mentoring Partner Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
  • 4. Jobs Applied Week Company Designation Applied Date Current Status 1 Advent software Sr. Application Engineer 28-8-2013 Short listed 2 Alcatel-lucent Software Engineer 30-8-2013 Waiting 3 Intel info group System Engineer 6-9-2013 Waiting
  • 5. Method overloading and constructor overloading in JAVA Muhammed Noufal V T muhammednoufalvt@gmail.com www.facebook.com/vtnoufalvt twitter.com/noufalurnappy in.linkedin.com/pub/muhammed-noufal 9744003056
  • 6. What is Method • A Java method is a collection of statements that are grouped together to perform an operation • A class can contain any number of methods. • Methods can be with parameter and without parameter. • The parameter in a method are called type signature.
  • 7. Method Overloading • Two or more methods within the same class that share the same name, but with different parameter declarations (type signatures). • The process is referred to as method overloading. • Overloading methods demonstrate the concept of polymorphism. • Overloaded methods may have different return types. • When java encounters a call to an overloaded method, it simply executes the version of the method whose parameters match the arguments used in the call.
  • 8. Example • { public class example_1 void square(int p1, int p2) int n1; int n2; example_1() { n1 = 10; n2 = 20; } void square() { System.out.println("The Square is " + n1 * n2); } void square(int p1) { n1 = p1; System.out.println("The Square is " + n1 * n2); } { n1 = p1; n2 = p2; System.out.println("The Square is " + n1 * n2); } public static void main(String args[]) { example_1 obj1 = new example_1(); obj1.square(); obj1.square(4); obj1.square(7,8); } }
  • 9. Constructor • • • • Special type of method A constructor initialize an object immediately upon creation Name of constructor must be same as name of Class Once defined, the constructor is automatically called immediately after the object is created before the new operator compleates • They do not specify any return type not even void
  • 10. Constructor Overloading • Constructors are methods that can be overloaded, just like any other method in a class. • Constructors having the same name with different parameter list is called constructor overloading.
  • 11. class Point { int x; int y; Point(int a, int b) { x = a; y = b; }} class Circle { int originX; int originY; int radius; Circle() { originX = 5; originY = 5; radius = 3; } Circle(int x1, int y1, int r) { originX = x1; originY = y1; radius = r; } Example Circle(Point p, int r) { originX = p.x; originY = p.y; radius = r; } void display() { System.out.println("--Center at " + originX + " and " + originY); System.out.println("Radius = " + radius); } public static void main(String args[]) { Circle c1 = new Circle(); Circle c2 = new Circle(10,20,5); Circle c3 = new Circle(new Point(15,25),10); c1.display(); c2.display(); c3.display(); }}
  • 12. Contact Us Emarald Mall (Big Bazar Building) Mavoor Road, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 Start up Village Eranakulam, Kerala, India. Email: info@baabtra.com NC Complex, Near Bus Stand Mukkam, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550