| Author |
Byte Wrapper class
|
RAGU KANNAN
Ranch Hand
Joined: Dec 16, 2005
Posts: 103
|
|
Hello, The byte limit is from -128 to +127. The following class tries to create wrapper class of Byte. Why this int value 123 is not doing implicit casting. Pls explain to me. Thanks, Raghu.K public class Test{ public static void main (String args[]){ Byte b = new Byte(123); System.out.println("b "+b); } }
|
 |
Keith Lynn
Ranch Hand
Joined: Feb 07, 2005
Posts: 2341
|
|
Method invocation conversion does not include narrowing primitive conversions. 123 is an int, and the only constructors in Byte accept a byte or a String, but not an int.
|
 |
shilpa Reddy
Ranch Hand
Joined: Jul 26, 2006
Posts: 42
|
|
|
can you give an example of for byte declaration.That wuld be helpful
|
 |
Gowher Naik
Ranch Hand
Joined: Feb 07, 2005
Posts: 643
|
|
Byte b1=new Byte((byte)123); Byte b2=new Byte("123");
|
 |
 |
|
|
subject: Byte Wrapper class
|
|
|