This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
1) The best example can be I/O streams in java. Normally whenever u create input or output stream, you will create bufferstream by passing the create I/O stream as parameter so that additional functionality to the stream can be provided by bufferstream. ex.. new BufferInputStream(new InputStream(new File()))..... 2) In AWT, all the decorations to the components(say borders etc) are provided through Decorator Pattern. I hope now you got better idea about how decorator pattern works.
Narasimha Reddy<BR>---------------<BR>Sun certified Enterprise architect(Part-I)<BR>Sun Certified Web Component Developer<BR>IBM Certified in OOAD with UML<BR>IBM Certified in enterprise connectivity test<BR>Oracle Certified in SQL and PL/SQL.<BR>Sun Certified Java2 Programmer
This is a good example. You can see more on this in Bruce Eckel's free electronic book- Thinking in Java, 2nd Ed. Go to http://www.mindview.net/Books/TIJ/ He describes how Java's I/O is controlled with the decorator.
Alan Shalloway.<BR>Look for Jim Trott and my book: <A HREF="http://www.amazon.com/exec/obidos/ASIN/0201715945/ref=ase_electricporkchop/103-0514572-3811868" TARGET=_blank rel="nofollow">Design Patterns Explained</A><BR>Visit our site <A HREF="http://www.netobjectives.com" TARGET=_blank rel="nofollow">Net Objectives</A>.<BR>Visit our <A HREF="http://www.netobjectives.com/dpexplained/index.html" TARGET=_blank rel="nofollow">Design Patterns Explained Community of Practice</A><BR>Check out our <A HREF="http://www.netobjectives.com/xml/xml_cdrom_info.htm" TARGET=_blank rel="nofollow">CDROM based audio training in XML</A>