Q1: |
Can classes inherit from more than one class?
|
A1: |
It's possible with some coding languages, but not Java. Multiple inheritance is a powerful feature, but it also makes object-oriented coding 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 a related group of tasks are handled by the same object, you can focus on that object if the tasks aren't being performed correctly. You don't have to worry about any other parts of the program.
|
Q3: |
When would you want to create a class that isn't public?
|
A3: |
The main time you would not want to make a class of objects available to other programs is when the class is strictly for the use of one program you're writing. If you're creating a game program and your RayGunReloader class of objects is highly specific to the game you're writing, it could be a private class. To keep a class from being public, leave off the public statement in front of class.
|
Q4: |
Why does the term "fifth column" refer to traitors, and what are the other four columns?
|
A4: |
The term was coined by Gen. Emilio Mola Vidal during the Spanish Civil War. As four Nationalist army columns approached Madrid in 1936, Vidal claimed that secret sympathizers within the city would serve as a "fifth column" helping to topple the Republican government. The term, along with "fifth columnist," now describes anyone working covertly against an existing government from within.
|