This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
What is peer classes. I know in java.awt.Component class there are peer classes. But i came to know String and StringBuffer classes are peer classes because they come at same level of heirarchy(and so if we have two constructors for a class that takes String in one and StringBuffer in other and if we try to invoke an object with string argument(at constructor) ,at o/p we get "constructors are ambigous" error). So what all Peers are there behaves in this way? Thanking You, JYOTHI ABRAHAM
Hi Jyothi, My definition of peer is not the same as you have mentioned. You must be aware that java.awt.* package API was developed in scant 21 days.The reason for such a rapid development is due to the peer concept, which Sun used for developing this API. For example, to develop some component like say Window, they did not try and define the class by itself.Instead, the class Window of AWT API invoked a call to its Operating System peer class to display the Window.These Operating System classes which are invoked, when we instantiate Java components like Frames, Windows, Buttons, etc. are called peers. Hope this helps, Sandeep SCJP2, OCSD(Oracle JDeveloper), OCED(Oracle Internet Platform)
Joined: Aug 14, 2001
Hai Sandeep, thanx,I understood that point. But why String and StringBuffer class behaves in that way,no matter peers or nonpeers.Any other classes display the same error?