A computer screen displaying Java code with the text 'Java Programming'" Caption: "Coding in Java
Coding in Java

Screen-Worthy Quotes: A Guide to Displaying Your Favorite Movie Lines

Table of Contents

Write, compile, and test a class that displays your favorite movie quote on the screen. Save the class as MovieQuote.java.

package chapter1;

public class MovieQuoteInfo {
    public static void main(String[] args) {
        System.out.println("humko sekha rya hai?");
        System.out.println("This dialouge was spoken by Amir Khan");
        System.out.println("In the movie PK,released in the year 2018");
    }
}

Explaination

This code is written in Java and defines a class named “MovieQuoteInfo” in the “chapter1” package. The class contains a single method, “main”, which is the entry point of the program.

When the program is executed, the “main” method will be executed and it will print three lines of text to the console:

  1. “Humko sekha rya hai?”
  2. “This dialouge was spoken by Amir Khan”
  3. “In the movie PK, released in the year 2018”

Each line is printed using the “System.out.println” statement, which outputs the text passed as an argument to the console. The program is simply printing a movie quote and some information about it.