Saturday, March 10, 2018

Java for Selenium - Mindmap Object, Classes and Inheritance

In the above example. We create a class bicycle which is defined by it's state and behavior.
members and methods are defined in the class. We can defined multiple objects of the class using class methods and members. 

Bicycle itself belongs to two wheeler class. Similarly there can be other class for motor bike which can have its own member and methods defined. 

Both bicycle and two wheeler can have specific methods and members defined in the class. 

Bicycle extends two wheeler which in turn extends vehicle, bicycle can use members and methods defined in two wheeler as well as vehicle class.

Class Declaration

class Bicycle extends TwoWheeler {
    // field, method and constructordeclarations
}

class TwoWheeler extends Vehicle {
    // field, method and constructordeclarations
}


Variables in a class:

Fields - Member variables in class
Local variable - defined inside method or block of scope
Parameters - variables in method declaration

Variable declaration : [Modifier] Type variablename

No comments:

Post a Comment