MISY350 Lecture Notes - Lecture 8: Return Statement
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.