Forums Register Login

Unsigned integers in Java

+Pie Number of slices to send: Send
Hi All!

How can I declare the usigned primitive integers in Java???

I tried the following code:
<code>
public class TestUnsigned {
public static void main(String[] args) {
unsigned int a = 10;
System.out.println(a);
}
}
</code>

But the above code does not compile. It gives "Not a statement" error.

I remember doing something like this... I am not sure whether it was Java or C++. I know that Java is not C++ (Bert) and actually repeated that a couple of times but I am confused here...
+Pie Number of slices to send: Send
Java doesn't have unsigned ints. If a plain int can't hold a large enough value, and you want to keep the code simple, you can use a long.
+Pie Number of slices to send: Send
That I was guessing... Thanks Ernest for clarifying it up...
if you think brussel sprouts are yummy, you should try any other food. And this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1194 times.
Similar Threads
Building C language's binary protocol strings in Java
SCPJ 1.4 - Dan's questons.. not clear
CRC16 with Polynominal : 0x8408, and Preset CRC : 0x6363
Please explain auto boxing behavior
Convert small C routine to Java
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 02:46:48.