Hey, World. Recently I've cracked open a book dealing with java for beginners. Each page my fingers turned, there was a problem to be solved, it led to brain busters, teasers, and much more. Unfortunately for me today, I've crossed a puzzle that I cannot crack. Here's my code:
class Movie { String title; String genre; int rating; void playIt() { System.out.println("Playing the movie"); } } public class MovieTestDrive { public static void main (String[] args){ Movie one = new Movie (); one.title = "Gone with the Stock"; one.genre = "Tragic"; one.rating = -2; Movie two = new Movie (); two.title = "Lost in Cubicle Space"; two.genre = "Comedy"; two.rating = 5; two.playIt(); Movie three = new Movie (); three.title = "Btye Club"; three.genre = "Tragic but ultimately uplifting"; three.rating = 127; } }
The problem is that I don't think it's working correctly, what exactly is this example in this book is trying to make me understand? The only result that I'm getting is "playing the movie." This is my first time working with a main class and sub class. Anyway, please explain this to me as you would a uneducated 10 year old.