Grokking Java Interview Questions
0% completed
Abstract Classes vs Interfaces
A class that begins class HalfPrice implements Limited, Coded can compile. A class that begins class HalfPrice extends Discount, Product cannot, and the compiler stops at the comma with the message '{' expected. The second line fails because a Java class may extend only one class, although it may implement several interfaces.
One reason for that difference is that a class can hold data in its objects and an interface cannot
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%