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:
- “Humko sekha rya hai?”
- “This dialouge was spoken by Amir Khan”
- “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.
Leave a Reply