Java Peer Class
Peer classes are written by java API developers to interface with native objects. Peer classes should be rightly mentioned as peer interfaces. You can program for the interface as if you are connecting to the C / C++ or any native objects. After doing the programming, you can use javah command line tool that is available in your jdk to generate the stub classes.
It will not have any attributes and you cannot inherit them. Those are just a handle for you to write your implementation based on them. Also every peer class is a parallel to a native class and it is a one to many mapping. One peer and many native objects. But mostly it will be used like one to one mapping.
The last sighting of peer classes was in JDK 1.0 (Component) had a method getPeer() which returned a ComponentPeer. But it was immediately deprecated in JDK 1.1 But all those classes are still residing in the JDK and used internally. There is a package java.awt.peer with a complete set of peers for platform dependent objects. You might need to write your own peer classes if you are going to write platform specific code and implementations. If not, just be aware about these peer classes and that’s simply enough.
This Core Java tutorial was added on 13/11/2009.