Advertisement
ahmfarisi

Dart PBO Part 2

Sep 18th, 2024 (edited)
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 0.38 KB | None | 0 0
  1. class Mobil {
  2.   String merek;
  3.   String model;
  4.   int tahunProduksi;
  5.  
  6.   Mobil(this.merek,this.model,this.tahunProduksi);
  7.  
  8.   void infoMobil(){
  9.     print('Mobil $merek $model $tahunProduksi');
  10.   }
  11. }
  12.  
  13. void main(){
  14.   var objMobil1 = Mobil('Toyota','Camry',2022);
  15.   var objMobil2 = Mobil('Mitsubishi','Xpander',2023);
  16.  
  17.   objMobil1.infoMobil();
  18.   objMobil2.infoMobil();
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement