Q&A

Q1:Can classes inherit from more than one class?
A1: It's possible with some programming languages, but not Java. Multiple inheritance is a powerful feature, but it also makes object-oriented programming a bit harder to learn and use. Java's developers decided to limit inheritance to one superclass for any class, although a class can have numerous subclasses. One way to compensate for this limitation is to inherit methods from a special type of class called an interface. You'll learn more about interfaces during Hour 19, “Creating a Threaded Program.”
Q2:Why are object-oriented programs easier to debug?
A2: Object-oriented programs enable you to focus on a smaller part of a computer program when figuring out where an error is happening. Because ...

Get SAMS Teach Yourself Programming with Java™ in 24 Hours, FOURTH EDITION now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.