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)
<b>Sandeep</b> <br /> <br /><b>Sun Certified Programmer for Java 2 Platform</b><br /> <br /><b>Oracle Certified Solution Developer - JDeveloper</b><br /><b>-- Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java </b><br /><b>-- Object-Oriented Analysis and Design with UML</b><br /> <br /><b>Oracle Certified Enterprise Developer - Oracle Internet Platform</b><br /><b>-- Enterprise Connectivity with J2EE </b><br /><b>-- Enterprise Development on the Oracle Internet Platform </b>
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?