Java Reference
In-Depth Information
System.out.println(first + " " + second + " " + SECRET_NUM);
hoursWorked = 35;
paycheck = hoursWorked * PAY_RATE;
System.out.println("Wages = " +
paycheck);
}
}
25. A correct answer is:
public class
Exercise25
{
static final char
STAR = '*';
static final int
PRIME = 71;
public static void
main(String[] arg)
{
int
count = 1;
int
sum = count + PRIME;
double
x = 25.67;
int
newNum = count * PRIME + 2;
sum = sum + count;
x = x + sum * count;
System.out.println(" count = " + count + ", sum = "
+ sum + ", PRIME = " + PRIME);
}
}
27. The
class
String
is contained in the package
java.lang
. You do not need
to import classes from the package
java.lang
. The system automatically does
it for you.
29.
a.
x = x + 5 - z;
b.
y = y * (2 * x + 5 - z);
c.
w = w + 2 * z + 4;
d.
x = x - (z + y - t);
e.
sum = sum + num;
f.
x = x / (y - 2);
Search WWH ::
Custom Search