• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Peer Classes

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)
 
jyothi abraham
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Any sufficiently advanced technology will be used as a cat toy. And this tiny ad contains a very small cat:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic