class WrapperTest
	public static void main(String[] args){
		Byte b = new Byte(3);
		Short s = new Short(34);

when I try to compile this is the problem I got

G:\WORK PLACE\work>javac WrapperTest.java
WrapperTest.java:4: cannot find symbol
symbol  : constructor Byte(int)
location: class java.lang.Byte
                Byte b = new Byte(4);
WrapperTest.java:5: cannot find symbol
symbol  : constructor Short(int)
location: class java.lang.Short
                Short s = new Short(34);
2 errors

Please tell me What is the problem of that constructor.

9 Years
Discussion Span
Last Post by sasidharnet

Probably because there isn't such constructor.
API for Byte object
API for Short object
The values in the parenthesis are not treated as byte and short but as int. I haven't try this and I don't know if it will work so don't blame me, but try:
Byte b = new Byte( (byte)3 );
Short s = new Short( (short)34 );

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.