Meaningless Drivel is fun!*
The moose likes Beginning Java and the fly likes what is the differences of these two? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "what is the differences of these two?" Watch "what is the differences of these two?" New topic
Author

what is the differences of these two?

hong Li
Greenhorn

Joined: May 15, 2008
Posts: 4
What is the difference between integer and Interger?
Sharon whipple
Ranch Hand

Joined: Jul 31, 2003
Posts: 294
integer is primitive type
Integer is complex type (class)

read more here :
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/datatypes.html
Marco Ehrentreich
best scout
Bartender

Joined: Mar 07, 2007
Posts: 1282

Hi hong,

I'd say usually Integer (with capital I) is a Java data type for integer numbers and integer (small i) is an integer number in general without any special meaning. That simple

Marco
Marco Ehrentreich
best scout
Bartender

Joined: Mar 07, 2007
Posts: 1282

@Sharon: The primitive type name is "int" not "integer". That could be confusing for Hong...
hong Li
Greenhorn

Joined: May 15, 2008
Posts: 4
thanks guys
Rakesh Chaudhary
Ranch Hand

Joined: Feb 19, 2008
Posts: 120
int is for decalring a primitive data type.

whereas Integer is a Wrapper class.

There are some classes which take object as there arguments at that time you can use ...Integer ...so that you can wrap a int value in a object and so on.. Please see the java 5.0 autoboxing.. enhancements thanks

for i.e
int i = 10; (prim)

Integer i;(Object..)

Thanks hope it helps


Acquire the unexpected.......
Preparing for SCJP 6
 
Consider Paul's rocket mass heater.
 
subject: what is the differences of these two?