aspose file tools*
The moose likes Beginning Java and the fly likes Byte Wrapper class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Byte Wrapper class" Watch "Byte Wrapper class" New topic
Author

Byte Wrapper class

Arjun Reddy
Ranch Hand

Joined: Nov 10, 2007
Posts: 627
Hi all,

I am trying to do this,

but it's giving me a compilation error as constructor Byte(int) is not defined. Why is it taking 10 as an int? But when I do this, it's working!!


Can someone tell me why?/

Thanks.


Be Humble... Be Nice.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11314
    
  16

because literals are taken as ints by default. The compiler is smart enough to figure out that

byte b=10;

is ok. However, there is no constructor for a Byte that takes an int, so it fails.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Arjun Reddy
Ranch Hand

Joined: Nov 10, 2007
Posts: 627
I did not know literals are take int by default. Thanks for the reply Fred.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Byte Wrapper class