The Movie Class
public class Movie {
private String title;
private String director;
private int year;
private double rating;
}
Constructor 1 — No Arguments (Defaults)
public Movie() { this.title = "Unknown"; this.director = "Unknown"; this.year = 0; this.rating = 0.0; }
Constructor 2 — Title and Year
public Movie(String title, int year) { this.title = title; this.year = year; this.director = "Unknown"; this.rating = 0.0; }
Constructor 3 — All Fields
public Movie(String title, String director, int year, double rating) { this.title = title; this.director = director; this.year = year; this.rating = rating; }
Create a Movie
No arguments needed — all fields will use default values.
Created Object
| Field | Value | Source |
|---|