Java Reference
In-Depth Information
2 .
if
(savings > expenses)
{
System.out.println("Solvent");
savings = savings - expenses;
expenses = 0;}
else
{
System.out.println("Bankrupt");
}
3 .
if
(number > 0)
System.out.println("Positive");
else
System.out.println("Not positive");
4 .
if
(salary < deductions)
{
System.out.println("Crazy");
}
else
{
System.out.println("OK");
net = salary - deductions;
}
5 .
large
6 .
small
7 .
medium
8 .
if
(n < 0)
System.out.println(n + " is less than zero.");
else if
(n < 100)
System.out.println(
n + " is between 0 and 99 (inclusive).");
else
System.out.println(n + " is 100 or larger.");
9.
Some kind of B.
10.
Oranges
11.
Plums
12.
Fruitless
13.
n1 >= n2
14.
if
(n1 >= n2)
System.out.println("n1");
else
System.out.println("n2");