object instance of java code example
Example 1: insanceof
The instanceof operator tests to see if the prototype property of a constructor
appears anywhere in the prototype chain of an object. The return value is a
boolean value.
For example :-
function Car(make, model, year) {
this.make = make;
this.model = model;
this.year = year;
}
const auto = new Car('Honda', 'Accord', 1998);
console.log(auto instanceof Car);
console.log(auto instanceof Object);
Example 2: create instance object java
myCar = new Car();