Java Reference
In-Depth Information
computation and then call it in the other method. This will provide a good clarity to your
code. In figure 1.8 this concept is illustrated. You should use this design feature with both
methods belong to the same class. In some other cases a method can be called from another
class to do some computation. We will see this design aspect when we discuss classes and
objects.
What is the use of creating 2 methods when we could do the same thing in one method?
There are a lot of powerful things which can be done when we do it this way. First, we
are delegating a task to be done to another method. This itself makes it possible to divide
the programming work among many people at the same time. The design of the software
product becomes easier when we divide the design into many parts.
Search WWH ::




Custom Search