A method is a piece of code that's used to perform some specific functionality. It may or may not return a value. And it may/may not tke parameters. Depending on how it is declared, it could also be used in different classes. It's the similar to procedures/functions in languages such as C/C++, and VB. I hope this helps. Bosun
Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
The term "method" comes from traditional object-oriented theory. An object performs actions by being sent "messages". Each message is processed by the language system to decide which "method" to dispatch it to. Languages such as Smalltalk make a clear distinction between the concepts of "message" and "method", but in Java it's not quite so obvious that they can be different. Imagine two classes, as follows:
As you can see, we have three methods: doit(String) and doit() in A and doit(String) in B. An object of either of the classes can respond to two messages doit() and doit(String) Imagine we have an object of class B (let's call it "b"). If we send the message "doit()" to our object by writing "b.doit()", the system does the following steps: 1. Does the class of the object have a method matching the message "doit()"? The answer is no, so ... 2. Does the superclass of the object have a method matching the message "doit()"? The answer is yes, so ... 3. Execute the method. In a "late-binding" language such as Smalltalk, this whole process is actually performed at runtime, but in Java, this process can sometimes be performed when the files are compiled.