A good answer might be:

Yes. Sounds like you could. This is called "hacking".

Problems with Hacking Code

If you have the source code for a class, you could copy the code and change it to do what you wanted. With pre-object-oriented languages this was your only choice. There are at least two problems with this: (i) keeping things organized, and (ii) the need to understand the original code.

(i) Say that you have several dozen classes and that your program needs serveral dozen more classes based on the original ones. You will end up with many dozens of source files which are all based on other source files in various ways. Without careful planning you will end up with an unorganized, inconsistent, buggy mess.

(ii) Say that you have a complicated class that basically does what you want, but you need a small addition. If edit the source code, even to make a small change, you risk breaking something. So you must study the original code to be sure that your changes are correct. This may not be easy.

The automatic inheritance mechanism of Java greatly relieves both of these problems.

QUESTION 2:

Say that class B is based upon class A. Which one would you call the parent class? Which one would you call the child class?