I am trying to print specific item from my ArrayList
I have super class named Item, I created a new class with ArrayList named db in the database I'm storing Cars,Bikes ,
ArrayList< Item > db = new ArrayList< Item >();
Car newCar = new Car(getModel(),getPrice());
db.add(newCar);
Bike newBike = new Bike(getModel(),getPrice())
db.add(newBike);
Now I'm trying to print only cars something like this,
if( db==newCar){
System.out.println("The first car is : "+db.car)
}
else{
System.out.println("The first bike is : "+db.car)
}