| Chapter 4 |
Writing Classes (p.190)
|
|||||||||||||
|
|
||||||||||||||
| Chapter Objectives . Define classes that act like blue-prints for new objects, made of variables and methods. . Explain encapsulation and Java modifiers. . Explore the details of method declarations. . Review method invocation and parameter passing. . Explain and use method overloading. . Learn to divide complicated methods into simpler, supporting methods. . Describe relationships between objects. . Create graphics based objects. |
||||||||||||||
|
||||||||||||||
|
Write a method called alarm that prints the string "Alarm!" multiple times on separate lines. The method should accept an integer parameter that specifies how many times the string is printed. Print an error message if the parameter is less than 1. |
||||||||||||||