• Post Reply Bookmark Topic Watch Topic
  • New Topic

Understanding Wrappers and primitive types  RSS feed

 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I've got a question to ask.


The output is "Wrapper".
What would be the reason behind it?
Thanks in advance..!
 
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nitin Menon wrote:
The output is "Wrapper".
What would be the reason behind it?


The output should be "Primitive".

Henry
 
Bartender
Posts: 1840
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm. I would have expected "Primitive" because that method can be matched without using auto-boxing.
And copying/pasting your code I get the answer: Primitive.
I'm running the standard JDK 1.7 on Windows.

Try running it again?
What Java version/implementation are you running and in what environment?
 
Ranch Hand
Posts: 104
1
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nitin Menon wrote:
The output is "Wrapper".
What would be the reason behind it?
Thanks in advance..!


I get the output "Primitive"

I am using on Java 8 on Windows.
 
Nitin Menon
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry guys..! That was a stupid mistake I made. Was compiling the wrong code.
 
Quazi Irfan
Ranch Hand
Posts: 104
1
Java Netbeans IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nitin Menon wrote:Was compiling the wrong code.


Using a good IDE can save you from this pain, i.e. IDE will save the source file before compilation, so you know you are using the latest version of the source.
 
Nitin Menon
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Quazi Irfan wrote:
Nitin Menon wrote:Was compiling the wrong code.


Using a good IDE can save you from this pain, i.e. IDE will save the source file before compilation, so you know you are using the latest version of the source.



I am using a good IDE (Eclipse Mars). It is just that I put the out message in the wrong method and did not notice it for some reason.
 
Marshal
Posts: 56600
172
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this FAQ and links therein would be more help. Remember: copy‑and‑paste from what you are actually running.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!