in JAVA by
Can we cast an int value into byte variable? what will happen if the value of int is larger than byte?

▼ Show 1 Answer

0 votes
Yes, we can cast but int is 32 bit long in java while byte is 8 bit long in java so when you cast an int to byte higher 24 bits are lost and a byte can only hold a value from -128 to 128.
Learn More with Madanswer

Related questions

0 votes
asked Mar 29, 2020 in JAVA by rajeshsharma