Category : Java | Sub Category : Object- oriented Programming | By Prasad Bonam Last updated: 2020-11-28 13:13:34 Viewed : 457
Classes:
Example 1: Car Class
Now the variables car1 and car2 represent
new instances of Car:
car1.color=“blue”; car2.color=“red”;!
These two Car instances are created with the new operator:
Car car1 = new Car();
Car car2 = new Car();