I don't see the point of returning
this on the set methods. For one, it
differs from the
Java Bean signature of
having set methods with void. Thus, using
these classes in a Web application or beans
in
jsp files would be non intuitive.
If your question is on stringing multiple
methods - and the context is demonstrating
the use of stringing multiple method calls
together, I would use the getXXX() method
rather than setXXX as the example. The Singleton
pattern uses the getClassName() method for
a class of type ClassName. So if I have
method doWork() in class Order, I might
see code like:
Order.getOrder().doWork();
Order.getOrder() returns a reference to an
Order object. getOrder() is a static method
in Order that returns the private reference
within the Singleton object. Now that I have a
reference, I can invoke a method ( just like I
was using the implicit "this" reference ).
------------------------------------------
Considering the Certified Java Programmer Exam?
Get JCertify!
http://www.enterprisedeveloper.com/jcertify The best investment in your career you will make all year