Home Segments Top Top Previous Next

116: Mainline

As shown in Segment 114, if you define movieRating in a class that is different from the one in which movieRating is called, you must preface the name of the method, movieRating, by the name of the class in which that method is defined, and you must join the two names by a dot.

The class name appears because Java allows you to define movieRating methods in more than one class. Thus, you must always specify which particular movieRating method you have in mind.