• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what is the differences of these two?

 
hong Li
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the difference between integer and Interger?
 
Sharon whipple
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Sharon: The primitive type name is "int" not "integer". That could be confusing for Hong...
 
hong Li
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks guys
 
Rakesh Chaudhary
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic