| | |
what is the wrong with Byte constructor which takes int value
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
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
Views: 1453 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for Java
911 addressbook android api append apple applet application arguments array arrays automation binary bluetooth character chat class classes client code component csv database draw eclipse error event exception file fractal ftp game givemetehcodez graphics gui helpwithhomework html ide image input integer j2me japplet java javaarraylist javaprojects jmf jni jpanel julia linked linux list loop map method methods mobile netbeans newbie number object objects oracle oriented panel print printf problem program programming project projects recursion replaydirector reporting researchinmotion return robot rotatetext scanner score screen se server set size sms socket sort sql stream string swing test threads time tree ubuntu windows






