Making Movie objects & knowing "This"

Run Settings
LanguageJava
Language Version
Run Command
// A Java program to print "Hello World" /*public class GFG { public static void main(String args[]) { System.out.println("Hello World"); } } */ class HitSongs{ String Hollywood_playlist ; String Bollywood_playlist; void playlists(){ System.out.println("Hitts->\nHollywood_playlist \n This Ref --> " +this +" \n Song Name : " + Hollywood_playlist); } } class Movie { String title; // System.out.println("TITLE -> " +this); String genre; //System.out.println("genre -> " +this); int rating; // System.out.println("RATING-> " +this); void playIt() { System.out.println("Playing the movie : \n This " +this + "\n Title -->"+ this+ " "+ this.title + "\n Genre -> "+genre + " \n Rating-->"+ this+" " + rating); } } class GFG{ public static void main(String[] args) { // System.out.println("Main here-> " this.main); Movie one = new Movie(); //System.out.println("Inside Movie reff1 -> " +this.one); one.title = "Gone with the Stock"; //System.out.println("TITLE 1-> " +this); one.genre = "Tragic"; // System.out.println("Tragic1 -> " +this); one.rating = -2; // System.out.println("Rating 1-> " +this); one.playIt(); Movie two = new Movie(); // System.out.println("2. Movie ref two -> " +this); two.title = "Lost in Cubicle Space"; // System.out.println("2.Title -> " +this); two.genre = "Comedy"; // System.out.println("2.Genre-> " +this); two.rating = 5; // System.out.println("3. Rating -> " +this); two.playIt(); System.out.println("Outside Play -> " ); Movie three = new Movie(); three.title = "Byte Club"; three.genre = "Tragic but ultimately uplifting"; three.rating = 127; three.playIt(); System.out.println("HEY ? NEW THIS " +three + " "+two +" "+one); HitSongs hs=new HitSongs(); hs.Hollywood_playlist =" Thousand Years !!!"; hs.playlists(); } }
class DVDPlayer { boolean canRecord = false; void recordDVD() { System.out.println(“DVD recording”); } } class DVDPlayerTestDrive { public static void main(String [] args) { DVDPlayer d = new DVDPlayer(); d.canRecord = true; d.playDVD(); if (d.canRecord == true) d.recordDVD(); } }
Editor Settings
Theme
Key bindings
Full width
Lines