aspose file tools*
The moose likes Beginning Java and the fly likes diffrences in definiotiones question.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "diffrences in definiotiones question.." Watch "diffrences in definiotiones question.." New topic
Author

diffrences in definiotiones question..

johny doe
Ranch Hand

Joined: Dec 07, 2007
Posts: 78
what is the difference between
when i define variable as
int

and

integer

what is the differnce between the two??
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14272
    
  21

Java has two kinds of data types: primitive types and non-primitive types.

int is a primitive type (a 32-bit signed integer), and Integer is a class. An int is much more lightweight than an Integer. You should use int, unless there's a reason that you need an object instead of a primitive type.

For more info:
The Java Tutorial - Primitive Data Types
The Java Tutorial - Object-Oriented Programming Concepts


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: diffrences in definiotiones question..