Page 125 - AP Computer Science A, 7th edition
P. 125

go to next line }
Output:
∗∗∗∗ ∗∗∗∗ ∗∗∗∗
Example 2
This example has two loops nested in an outer loop.
for (int i = 1; i <= 6; i++) {
for (int j = 1; j <= i; j++) System.out.print("+");
for (int j = 1; j <= 6 – i; j++) System.out.print("∗ ");
System.out.println();
Output:
+∗ ∗ ∗ ∗ ∗ ++∗ ∗ ∗ ∗ +++∗ ∗ ∗ ++++∗ ∗ +++++∗ ++++++
ERRORS AND EXCEPTIONS
An exception is an error condition that occurs during the execution of a Java program. For example, if you divide an integer by zero, an ArithmeticException will be thrown. If you use a negative array index, an ArrayIndexOutOfBoundsException will be thrown.
}
  An unchecked exception is one where you don’t provide code to




















































































   123   124   125   126   127