I have just started to learn Java. Read a small book but I didnt catch information about key: value objects.
for example in javascript:
let car = {
type:"Fiat",
model:"500",
color:"white"
};
but in java there is only classes, which create an object:
public class CarObject {
public static void main(String[] args) {
Car car = new Car("Fiat", "500", "White");
}
}
class Car{
String type;
String model;
String color;
public Car(String type, String model, String color){
this.color = color;
this.model = model;
this.type = type;
}
}
So, my question is if in Java language there is no such thing like key: value. Or there is no sense to use it, because of used classes?