public class Car {
String carname;
String model;
String owner;
Integer year;
// Constructor to initialize the Car object
public Car(String carname, String model, String owner, Integer year) {
this.carname = carname;
this.model = model;
this.owner = owner;
this.year = year;
}
// Method to display car details
public void show() {
System.debug('Car name: ' + this.carname);
System.debug('Model name: ' + this.model);
System.debug('Owner name: ' + this.owner);
System.debug('Year: ' + this.year);
}
}
// Creating an instance of the Car class and initializing it
Car c1 = new Car('Ford Ecosport', 'Diesel', 'Manan', 2024);
c1.show();
cHVibGljIGNsYXNzIENhciB7CiAgICBTdHJpbmcgY2FybmFtZTsKICAgIFN0cmluZyBtb2RlbDsKICAgIFN0cmluZyBvd25lcjsKICAgIEludGVnZXIgeWVhcjsKCiAgICAvLyBDb25zdHJ1Y3RvciB0byBpbml0aWFsaXplIHRoZSBDYXIgb2JqZWN0CiAgICBwdWJsaWMgQ2FyKFN0cmluZyBjYXJuYW1lLCBTdHJpbmcgbW9kZWwsIFN0cmluZyBvd25lciwgSW50ZWdlciB5ZWFyKSB7CiAgICAgICAgdGhpcy5jYXJuYW1lID0gY2FybmFtZTsKICAgICAgICB0aGlzLm1vZGVsID0gbW9kZWw7CiAgICAgICAgdGhpcy5vd25lciA9IG93bmVyOwogICAgICAgIHRoaXMueWVhciA9IHllYXI7CiAgICB9CgogICAgLy8gTWV0aG9kIHRvIGRpc3BsYXkgY2FyIGRldGFpbHMKICAgIHB1YmxpYyB2b2lkIHNob3coKSB7CiAgICAgICAgU3lzdGVtLmRlYnVnKCdDYXIgbmFtZTogJyArIHRoaXMuY2FybmFtZSk7CiAgICAgICAgU3lzdGVtLmRlYnVnKCdNb2RlbCBuYW1lOiAnICsgdGhpcy5tb2RlbCk7CiAgICAgICAgU3lzdGVtLmRlYnVnKCdPd25lciBuYW1lOiAnICsgdGhpcy5vd25lcik7CiAgICAgICAgU3lzdGVtLmRlYnVnKCdZZWFyOiAnICsgdGhpcy55ZWFyKTsKICAgIH0KfQoKLy8gQ3JlYXRpbmcgYW4gaW5zdGFuY2Ugb2YgdGhlIENhciBjbGFzcyBhbmQgaW5pdGlhbGl6aW5nIGl0CkNhciBjMSA9IG5ldyBDYXIoJ0ZvcmQgRWNvc3BvcnQnLCAnRGllc2VsJywgJ01hbmFuJywgMjAyNCk7CmMxLnNob3coKTsK