Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis+ 3
How can I assign a Byte value type to an int variable in Java?
I do like this but I get error Byte n1=120; Byte n2=120; short n3 =20000; short total=(short)(n1+n2+n3);
7 Respostas
+ 16
Dear Asina
This code contains some information for you. BTW, your way of conversion between types has no issue in this particular case.
[https://code.sololearn.com/czszbMDuPjFc]
+ 15
ā¬šššā¬
šā¬ā¬ā¬š
ššššš
šā¬ā¬ā¬š
šā¬ā¬ā¬š
ā¬šššš
šā¬ā¬ā¬ā¬
ā¬šššā¬
ā¬ā¬ā¬ā¬š
ššššā¬
ā¬šššā¬
ā¬ā¬šā¬ā¬
ā¬ā¬šā¬ā¬
ā¬ā¬šā¬ā¬
ā¬šššā¬
šā¬ā¬ā¬š
ššā¬ā¬š
šā¬šā¬š
šā¬ā¬šš
šā¬ā¬ā¬š
ā¬šššā¬
šā¬ā¬ā¬š
ššššš
šā¬ā¬ā¬š
šā¬ā¬ā¬š
+ 14
ā¬š¹š¹š¹ā¬
ā¬ā¬š¹ā¬ā¬
ā¬ā¬š¹ā¬ā¬
ā¬ā¬š¹ā¬ā¬
ā¬š¹š¹š¹ā¬
š¹š¹š¹š¹ā¬
š¹ā¬ā¬ā¬š¹
š¹š¹š¹š¹ā¬
š¹ā¬ā¬ā¬ā¬
š¹ā¬ā¬ā¬ā¬
ā¬š¹š¹š¹ā¬
š¹ā¬ā¬ā¬š¹
š¹š¹š¹š¹š¹
š¹ā¬ā¬ā¬š¹
š¹ā¬ā¬ā¬š¹
š¹ā¬ā¬ā¬š¹
š¹š¹ā¬ā¬š¹
š¹ā¬š¹ā¬š¹
š¹ā¬ā¬š¹š¹
š¹ā¬ā¬ā¬š¹
ā¬š¹š¹š¹ā¬
š¹ā¬ā¬ā¬ā¬
š¹ā¬ā¬š¹š¹
š¹ā¬ā¬ā¬š¹
ā¬š¹š¹š¹ā¬
+ 5
What error did you get? I run your code just fine in Code Playground, just added simple print statement.
public class Program
{
public static void main(String[] args)
{
byte n1=120; byte n2=120; short n3 =20000;
short total=(short)(n1+n2+n3);
System.out.println(total);
}
}
+ 5
@Babak is more than a helping hand, and also has artistic sense with emoji :D
#W.O.W#
+ 4
@Babak, very well explained mate, salute! thank you :)
+ 2
@Babak
thank you from all time help..