| | |
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 |
account android api applet application array arrays automation bidirectional binary birt bluetooth class classes client code columns component constructor database designadrawingapplicationusingjavajslider draw eclipse error errors exception expand fractal game givemetehcodez graphics gui guidancer homework html ide image inetaddress inheritance integer intellij j2me java javamicroeditionuseofmotionsensor javaprojects jlabel jme jni jpanel jtextfield jtree julia linux list loop map method methods midlethttpconnection mobile mobiledevelopmentcreatejar monitoring myaggfun netbeans newbie nullpointerexception open-source oracle plazmic print problem program project property recursion ria scanner search server set sharepoint smart sms smsspam sort sourcelabs splash sql sqlite static string subclass support swing testautomation threads tree unlimited webservices windows






