In the following example, the definition of the
movieRating
method appears in a complete program containing wired-in
test data, which produces a resulting value of 23
when the program
is executed.
public class Demonstrate { public static void main (String argv[]) { int script = 6, acting = 9, direction = 8; System.out.print("The rating of the movie is "); System.out.println(movieRating(script, acting, direction)); } public static int movieRating (int s, int a, int d) { return s + a + d; } } --- Result --- The rating of the movie is 23