these are classes defined in java.lang package (one class per primitive type) which can be used to wrap around primitive types so that the primitive types can be used where an reference to an object is required.
as for example if you are willing to make a Vector of ints, you cannot add an int to it, but you can add the int by wrapping it inside an Integer class.
the wrapper classes also provide static methods which can be used to extract properties of the primnitive type, like one can find the maximum value an int can hold by calling a static method of Integer class.
There are several meanings of adapter; note the unusual spelling. There is a design pattern of that name, and there are abstract classes which implement a Listener interface (eg MouseAdapter).
You can also have a wrapper which mimics the methods of another class. You can have a class with [EMAIL]n[/EMAIL] methods, and you have another class with n methods with exactly the same names. The second class "wraps" an instance of the first class, so it is a "wrapper" to the other class. Each method of the wrapper does some sort of controlling code, then calls the method of the same name in the other class.
You have probably got wrappers answered; adapters probably are too complicated for the beginner's forum: moving.
Joined: Dec 17, 2008
does that mean that even inheritance is some kind of wrapping?
As already said above, a wrapper class is something that wraps another class to provide methods/functionality/interface usually for integration.
A very simple but effective example is that of the wrapper classes for primitive data types. You might have used the following piece of code atleast once in your programming.
Integer.parseInt("some string representing a numeric value");
Now since you cannot have methods for the int primitive type, the Integer class is handy in such situations. Also if you are familiar with Collections, then all of the collections are meant to hold objects and one cannot place integer or double values in them without using a wrapper or a string representation of that value.
Now this is also far different from inheritance as there is no way to inherit the primitives or say final classes.But nothing stops you from wrapping them .
You see there are 4 methods in the Engine interface, and there are 4 methods in the Car class which are very similar. They simply call the Engine methods. You are using the Car as a Wrapper for the Engine; by calling a Car method you are simply passed to the Engine.This will appear like an ordinary List, but each method does something special. It has an ordinary List as a field, and each method calls the List method of the same name. Each method adds some special functionality to the List; it doesn't matter what, but there is (I think) an example in Joshua Bloch's Effective Java where each method adds thread-locking. Minor changes to method names[/edit] [ December 19, 2008: Message edited by: Campbell Ritchie ]