Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Car {
- private int year;
- private Model model;
- private Color color;
- // Constructor for setting the value of data for year, model, and color
- public Car(int year, Model model, Color color) {
- this.year = year;
- this.model = model;
- this.color = color;
- }
- // Method for printing the value of variables
- public void print() {
- System.out.println("Model: " + model);
- System.out.println("Color: " + color);
- System.out.println("Year: " + year);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement