File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "diffrences in definiotiones question.." Watch "diffrences in definiotiones question.." New topic

diffrences in definiotiones question..

johny doe
Ranch Hand

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



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

Joined: Aug 16, 2005
Posts: 15092

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:
subject: diffrences in definiotiones question..
jQuery in Action, 3rd edition