1. Write two different Java statements that each compute the cube of an integer x.
2. Classify each of the following Java statements as either legal or illegal. Let b, s, i, l, f, and d represent variables of type byte, short, int, long, float, and double, respectively.
a. d = l;
b. l = f;
c. i = b;
d. i = s;
e. b = s;
f. i = d;
3. What is the data type of each of the following expressions if i, l, f, and d represent variables of type int, long, float, and double, respectively?
a. f + d
b. d * i
c. l – i
d. i / f
e. l % d
f. l * l
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here