MISY350 Lecture Notes - Lecture 8: Return Statement

87 views6 pages

Document Summary

Functions/methods part 1: methods and functions are pretty much the same, methods are used in the object oriented world. *main method represents the starting and ending point using the brackets main method becomes method calls breaks up methods if a method isn"t called in main method, it doesn"t execute the output. Will return a double bc squaring it also gives u a double. Whatever the result is, is what the return type will be. When we call the method, we need to supply it a double. Num =42, java knows to pass it to x: then will output whatever the return value is, replaces result statement. An integer array (int[]), and item: for loop i=0, i is less than the length of the array that"s been passed in (nums. length) increment it by 1 (i++) Test if the item is equal to i-th item. Break = breaks out of the loop. Target is declared inside main which has no value in.

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