Home Segments Top Top Previous Next

102: Mainline

Here is what each part of the method definition does:

  *-- Indicates that the method can be called from any other method 
  |      *-- Indicates that the method is a class method 
  |      |     *--Tells Java the data type of the returned value 
  |      |     |    *-- Tells Java the name of the method 
  |      |     |    |            *-- Tells Java the names and 
  |      |     |    |            |   data types of the parameters 
  v      v     v    v            v 
------ ------ --- ------------ ------------------- 
public static int movieRating (int s, int a, int d) {  <--* 
 return s + a + d;                                        | 
 ------ ---------          Marks where the body begins ---* 
   ^        ^ 
   |        | 
   |        *-- The expression whose value is to be returned 
   *-- Marks the value that is to be returned by the method 

}  <-- Marks where the body ends