If you propose to compute the ratings of
many movies, you certainly should define a rating-computing method, perhaps
named movieRating
, to do the work. Once you have defined the
movieRating
method, you can have the main
method
call
the movieRating
method as in the following example:
public class Demonstrate {
// Definition of movieRating goes here
public static void main (String argv[]) {
System.out.print("The rating of the movie is ");
System.out.println(movieRating(6, 9, 8));
}
}
In the example, the movieRating
method has three arguments: 6
, 9
, and 8
. As illustrated,
Java requires method arguments to be separated by commas.