Add properties to car class
You will add more features to the Car
class and a few properties that mimic a real car. A real car has endless features, but for now, you will only add the car's color
, model
, and year
of manufacture.
Este exercício faz parte do curso
Introduction to Object-Oriented Programming in Java
Instruções do exercício
- Add a string property
color
to theCar
class for thecolor
of a car. - Add a string property
model
to theCar
class for themodel
of a car. - Add an integer property
year
to theCar
class to theyear
a car was made.
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
class Main {
static class Car {
// Create the properties for the class
____ ____;
____ ____;
____ ____;
}
public static void main(String[] args) {
}
}