Programming and Problem Solving with Java

(やまだぃちぅ) #1

726


10.switch(n)
{
case 3 : alpha++;
break;
case 7 : beta++;
break;
case 10 : gamma++;
break;
}
15.Nothing is printed. A forloop is a pretest loop.
17.********* *********
******** ********
******* *******
****** ******
***** *****
**** ****
*** ***
** **
* *


  1. a. expression
    b.expression
    c. expression statement
    d.expression


Chapter 9 Programming Warm-Up Exercises


  1. a.MyException anException;
    b.public classMyException extendsException
    {
    publicMyException()
    {
    super();
    }
    publicMyException(String message)
    {
    super(message);
    }
    }
    c. throw newMyException("Error somewhere.");
    4.switch(grade)
    {
    case'A': sum = sum + 4 ;
    break;

Free download pdf