Why would you declare an Interface and then instantiate an object with it in Java?

后端 未结 10 1311
再見小時候
再見小時候 2020-12-13 06:41

A friend and I are studying Java. We were looking at interfaces today and we got into a bit of an discussion about how interfaces are used.

The example code my frie

10条回答
  •  -上瘾入骨i
    2020-12-13 07:29

    With "IVehicle modeOfTransport1 = new Car();", methods owned only by Car are not accessible to modeOfTransport1. I don't know the reason anyway.

提交回复
热议问题