File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes clarify my doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "clarify my doubt" Watch "clarify my doubt" New topic
Author

clarify my doubt

karthik. G gopalan
Greenhorn

Joined: Oct 17, 2006
Posts: 5
what is the difference between using int and Integer types in java. and also tel me about the wrapper classes and why they are used.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14338
    
  22

The data type "int" is a primitive type, and "Integer" is a class; it's a wrapper class for "int".

In Java, primitives are not objects. Sometimes that is inconvenient. For example, in collection classes such as ArrayList, Vector etc. you can only store objects. You can't store primitives in those collections. Wrapper classes are used to represent the primitive types as objects, so you can for example store them in a collection.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: clarify my doubt