class Vehicle { float weight ; //in pounds String typeOffuel ; //electric petrol diesel int topSpeed ; //mph } class Train extends Vehicle { int numberOfCarriages ; } public class Inheritance { public static void main( String args[] ) { Train trainObject = new Train() ; //train has Vehicle's properties also trainObject.topSpeed = 90 ; Vehicle vehicleObject = trainObject ; //A train object is also a vehicle object } }