• Post Reply Bookmark Topic Watch Topic
  • New Topic

Byte wrapper class  RSS feed

 
Jason Attin
Ranch Hand
Posts: 234
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys I didn't realize this was allowed:

I thought that since we are creating a wrapper class we had to use a constructor of the type new Byte(1) or something like that?
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jason Attin wrote:
I thought that since we are creating a wrapper class we had to use a constructor of the type new Byte(1) or something like that?


The code that is generated will go through autoboxing at runtime. Additionally, there is a compile time constant rule in place (subsection of section 5.2), to allow the autoboxing conversion by the compiler too.

Henry
 
Jason Attin
Ranch Hand
Posts: 234
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So that will be the same for every wrapper class, like we can do something like
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!