0

I understand that webdriver is an interface of which driver is a reference variable. But in Java the reference variable holds a reference to the object. It does not hold the memory address of the object but a reference. Now webdriver is an interface and it's reference variable is driver which will refer the object of Chrome driver. So if it is only going to point to the chromedriver object, then a chromedriver object reference variable can do that. It's not like it will hold the properties of webdriver interface, chrome driver class is already doing that.

Can someone explain this concept to me and please don't post interface or top casting links? I am aware that this is top casting i am just trying to understand the purpose of this line here.

Sahil
  • 1
  • 1
  • 1
    "It does not hold the memory address of the object but a reference." This is a distinction without a difference. – azurefrog Jun 07 '21 at 20:57
  • 2
    it just means that you can use the same methods on Chromedriver, Geckodriver, IEDriver, etc... so it's a way to standardize the drivers and lets you and the IDE know what methods/properties/return types are guaranteed for the type of "webdriver". – pcalkins Jun 07 '21 at 21:29

0 Answers0