CSC 120 Lecture Notes - Lecture 5: Return Type
CSC 120 verified notes
5/22View all
Document Summary
A class may have as many methods as one wants. The order of the methods does not matter in java. A method is a collection of statements that perform some specific task and return result to the caller. A method can perform some specific task without returning anything. Methods allow us to reuse the code without retyping the code. In java, every method must be part of some class and which. Methods are time savers and help us to reuse the code without retyping the code. https://www. geeksforgeeks. org/methods-in-java/ 1- public- the one csc120 will be using. Return type: the data type of the value that will be returned by the method or void if does not return a value. Method name: a name chosen by the user. Parameter list: you must put your values with their data type in the paranthesis. If there is more than one value, they must be separated by comma.