This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
Tom Welcome to the Java Ranch, we hope you�ll enjoy visiting as a regular however, your name is not in keeping with our naming policy here at the ranch. Please change your display name to an appropriate name as shown in the policy. Thanks again and we hope to see you around the ranch!! Tom, a more appropriate question is why are there primitives if Java is supposed to be an object oriented language. The primitives are there to speed things up and allow the compiler to make optimizations. In a pure object oriented language there qwould be no primitives and you would only have the objects (Integer, Double, Boolean, etc. ). A big use is in collections that can only hold objects you can not put an int there but an Integer works just fine. hope that helps
You have to use instead of primitive type (int, float, double,...) wrapper classes if you use it with Vector, Hashtable, ArrayList, Map, ... etc. Because in standard Java no exist Vector of int, only Vector of Object. (Of course exists a lot of non-standard implementation of int vector, because it's important sometime to optimize code; wrapping isn't time and memory effective). ---------------------------------------------- As I understand will be in java 1.5 template construction like Vector<...> is only syntax sugar. (I read somewhere that it will be the same container library: Vector, Hashtable... for template and non-template syntax usage) And doesn't solve the problem. Am I right ?