Java Reference
In-Depth Information
public static void main(String[] arg)
{
count = 1;
sum = count + PRIME;
x := 25.67;
newNum = count * ONE + 2;
sum + count = sum;
x = x + sum * COUNT;
System.out.println(" count = " + count + ", sum = "
+ sum + ", PRIME = " + Prime);
2
}
}
26. What action must be taken, before a variable can be used in a program?
27. Explain why the class String need not be explicitly imported in a
program using an import statement.
28. Write equivalent compound statements for the following, if possible.
a. x = 2 * x;
b. x = x + y - 2;
c. sum = sum + num;
d. z = z * x + 2 * z;
e. y = y / (x + 5);
29. Write the following compound statements as equivalent simple statements.
a.
x += 5 - z;
y *= 2 * x + 5 - z;
b.
w += 2 * z + 4;
c.
x -= z + y - t;
d.
sum += num;
e.
x /= y - 2;
f.
Suppose a , b , and c are int variables and a = 5 and b = 6 . What value is
assigned to each variable after each statement executes? If a variable is
undefined at a particular statement, report UND (undefined).
30.
a
b
c
a = (b++) + 3;
c = 2 * a + (++b);
b = 2 * (++c) - (a++);
Suppose a , b , and sum are int variables and c is a double variable. What
value is assigned to each variable after each statement executes? Suppose
a = 3 , b = 5 , and c = 14.1 .
31.
Search WWH ::




Custom Search