L6.2: Classes & Objects example

PHOTO EMBED

Tue Oct 17 2023 09:02:20 GMT+0000 (Coordinated Universal Time)

Saved by @testpro #java

    public class Main {
        public static void main (String[] args) {

            Cars azatFirstCar = new Cars();
            azatFirstCar.brand = "Mazda" ;
            azatFirstCar.year = 2005 ;
            azatFirstCar.color = "blue" ;

            Cars azatSecondCar = new Cars () ;
            azatSecondCar.color = "black" ;
            azatSecondCar.year = 2020 ;
            azatSecondCar.brand = "BMW" ;

            System.out.println(azatFirstCar.brand);
            System.out.println(azatSecondCar.brand);
        }
    }
/* Output:
Mazda
BMW
*/
content_copyCOPY