| | |
what is the wrong with Byte constructor which takes int value
![]() |
•
•
Join Date: Aug 2007
Posts: 8
Reputation:
Solved Threads: 0
java Syntax (Toggle Plain Text)
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
Java Syntax (Toggle Plain Text)
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.
Last edited by WolfPack; Mar 26th, 2008 at 9:32 am. Reason: Added code tags. USe them when you post code.
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 );
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 );
Check out my New Bike at my Public Profile at the "About Me" tab
![]() |
Other Threads in the Java Forum
- Previous Thread: Plz gv me a example(sample code) how to connect the database into the JTable
- Next Thread: Swing: default button problem
| Thread Tools | Search this Thread |
android api applet application apps array arrays automation awt bidirectional binary birt bluetooth businessintelligence busy_handler(null) card chat class classes client code collision columns component constructor database designadrawingapplicationusingjavajslider draw eclipse editor error errors eventlistener exception expand fractal game givemetehcodez graphics gui guidancer html ide image inetaddress input integer intellij j2me java javafx javamicroeditionuseofmotionsensor javaprojects jme jni jpanel jtree julia linux list loop machine map method methods mobile mobiledevelopmentcreatejar myaggfun netbeans newbie oracle parsing plazmic print problem program programming project recursion scanner server set sharepoint size smart sms smsspam sort sortedmaps sql string subclass support swing threads tree unlimited utility webservices windows






