Home Segments Top Top Previous Next

211: Mainline

Because it uses the new definition of the Movie class introduced in Segment 210, the following main method does not need to assign values to the instance variables:

public class Demonstrate { 
 // Define main: 
 public static void main (String argv[]) { 
  Movie m = new Movie(); 
  System.out.println("The rating of the movie is " + m.rating()); 
 } 
} 
--- Result --- 
The rating of the movie is 15