wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes What is the difference between java.lang.Integer and Integer.Type Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "What is the difference between java.lang.Integer and Integer.Type" Watch "What is the difference between java.lang.Integer and Integer.Type" New topic
Author

What is the difference between java.lang.Integer and Integer.Type

O. Ziggy
Ranch Hand

Joined: Oct 02, 2005
Posts: 430

I was trying to figure out the return type as a result of the following use of List.toLower() methods.



The output of the above is:

Type is java.lang.Integer - java.lang.Integer
Type is Integer.Type - false


What exactly is the difference? Is Integer.Type not just the type of java.lang.Integer?

Thanks in advance.

Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3611
    
  14

No. Integer.Type is the type of int, if you read the documentation carefully. int is not the same type as Integer.
Ganesan Ponnusamy
EPractice Labs Support
Ranch Hand

Joined: Nov 07, 2005
Posts: 249
setTimes.lower(1605)).getClass() return class representation of primitive Integer object (return java.lang.Integer).
Integer.TYPE - The Class instance representing the primitive type int (return int).

You may try this system.out.

System.out.println("" + (Integer.TYPE)); // print int
System.out.println(""+(setTimes.lower(1605)).getClass()); // return java.lang.Integer


Ganesan Ponnusamy Java Certification | Test Generator | OCAJP | OCPJP | OCEJWSD | EJB Certification
OCEJPAD | SCJD | SCWCD | SCBCD | SCDJWS | OCMJEA | Web Services Certification | SCMAD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is the difference between java.lang.Integer and Integer.Type