• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 430
Android VI Editor Debian
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Saloon Keeper
Posts: 15484
363
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No. Integer.Type is the type of int, if you read the documentation carefully. int is not the same type as Integer.
 
MyExamCloud Support
Posts: 264
5
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic