This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Peer Classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Peer Classes" Watch "Peer Classes" New topic
Author

Peer Classes

jyothi abraham
Ranch Hand

Joined: Aug 14, 2001
Posts: 46
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
Desai Sandeep
Ranch Hand

Joined: Apr 02, 2001
Posts: 1157
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>
jyothi abraham
Ranch Hand

Joined: Aug 14, 2001
Posts: 46
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?
 
jQuery in Action, 2nd edition
 
subject: Peer Classes
 
Similar Threads
what should i know about Strings in the 1.4 exam
peer class
Queries
Reg. == for object references
What is the reason ?