I CSI 201 Chapter Notes - Chapter 5: Code Reuse, Memory Address, Functional Decomposition
Document Summary
* methods are commonly used to break a problem down into small manageable pieces. If a specific task is performed in several places in the program, a method can be written once to perform that task, and then be executed anytime it is needed. This is known as code reuse. void methods and value-returning methods. A void method is one that simply performs a task and then terminates. A value-returning method not only performs a task, but also sends a value back to the code that called it. int number = integer. parseint(700); To create a method, you must write a definition, which consists of a header and a body. The method header, which appears at the beginning of a method definition, lists several important things about the method, including the method"s name. The method body is a collection of statements that are performed when the method is executed.