Articles : JavaBoutique's Introduction to Java :
Object-Oriented Design :

Overloading

Contents
Introduction to Object Oriented Design
Procedural-Based Programming
Limitations of Procedural-Oriented Programming
Object-Oriented Programming
Objects
Encapsulation
Application Programming Interface (API)
Inheritance
Overloading
Polymorphism

Objects are also smart enough to be dynamic. Specifically, they have the ability to react differently depending on the situation.

This is important because it makes the API both flexible and easy to understand for the incoming developer. That is, the API has the ability to grow as needed without affecting older code.

Let's look at an example. Suppose you have a method called "print()".

The first question you might ask is, "what does this method print: pictures, text, or what?"

Well using "overloading", an object can be made to handle any scenario with the exact same method name. Thus, depending on what the object is asked to print, it will be able to print it.

Instead of having separate methods like printPicture(), printLetters(), and printNumbers() you have one unified print() and the object itself determines how to handle the different types of situations.

NEXT


Selena Sol contributes to the JavaBoutique's Introduction to Java. Selena curently works for Barclays Capital in London, one of the leading global investment banks in Europe and has worked as a software developer for the National Center for Human Genome research, Microline Software, Neuron Data, and Electric Eye in Singapore. Selena is perhaps best-known for creating the Public Domain Web Script Archive (Extropia) and writing several books on Web Programming (Perl, CGI, Java).
Email: selena@extropia.com

How to Add Java Applets to Your Site

New on the Java Boutique:

New Review:

Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling API boasts simplicity, ease-of-integration, a well-rounded feature set, and it's free!

New Applet:

Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA sequences into three useful formats.

Elsewhere on internet.com:

WebDeveloper Java
Lots of Java information on webdeveloper.com

WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.

ScriptSearch Java
Hundreds of free Java code files to download.

jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.