Answer the question
In order to leave comments, you need to log in
How does the following code snippet work?
How does a piece of code in curly braces work?
public class CarService {
// car storage
List<Car> cars = new ArrayList<>();
// cars in our dealership
{
cars.add(new Car(Mark.BMW, Model.I4, 2021, 3_000_000L));
cars.add(new Car(Mark.TOYOTA, Model.CAMRY, 2011, 10_000_000L));
cars.add(new Car( Mark.AUDI, Model.A5, 2007, 5_000_000L));
cars.add(new Car(Mark.AUDI, Model.A5, 2007, 5_000_000L));
cars.add(new Car( Mark.AUDI, Model.A5, 2007, 5_000_000L));
cars.add(new Car( Mark.FORD, Model.MUSTANG, 1994, 7_000_000L));
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question