adplus-dvertising
frame-decoration

Question

Which of the following are legal lines of Java code?

1. int w = (int)888.8;
2. byte x = (byte)100L;
3. long y = (byte)100;
4. byte z = (byte)100L;

a.

1 and 2

b.

2 and 3

c.

3 and 4

d.

All statements are correct

Posted under Java Programming

Answer: (d).All statements are correct

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Which of the following are legal lines of Java code? 1. int w = (int)888.8; 2. byte x = (byte)100L; 3. long y = (byte)100; 4. byte z = (byte)100L;