Will this code be compiled?

long x = 5; 
long y = 2;
byte b = (byte) x / y;
Ti make it compile you need to change order of operations like this: byte b = (byte)(x/y);

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Java quizzes
Sign Up Now
or Subscribe for future quizzes