I CSI 201 Chapter Notes - Chapter 5: Memory Address, Immutable Object, Code Reuse

46 views4 pages

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. Two parts of method declaration public static void displaymesssage()

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents