CCPS 209 midterm 1 exam questions & answers 2024/2025
Is-a Relationship - ANSWERSThe phrase "is-a" is in common use in computer science. The arrow between a child and parent is sometimes called an "is-a link".
parent class vs child class - ANSWERSA parent class is a blueprint that is follow...
Is-a Relationship - ANSWERSThe phrase "is-a" is in common use in computer science. The arrow between
a child and parent is sometimes called an "is-a link".
parent class vs child class - ANSWERSA parent class is a blueprint that is followed when an object is
constructed. A child class of the parent is another blueprint (that looks much like the original), but with
added features. The child class is used to construct objects that look like the parent's objects, but with
added features.
other names - ANSWERSparent-child, superclass-subclass base class - derived class
hierarchy - ANSWERSn a hierarchy, each class has at most one parent but might have several children
classes. The class at the top of the hierarchy has no parent. This class is called the root of the hierarchy.
example of applet - ANSWERSclass yourApplet extends JApplet
{
// new characteristics of your applet go here
}
, The characteristics of applets are inherited from the base class JApplet. This base class contains the
details of working with Web browsers, with setting up graphics, and many other things. You get all that
automatically by inheritance. All you do is add the additional characteristics you want.
Using a Super Class's Constructor - ANSWERSsuper(arguments);
which of the superclasses constructors get invoked? - ANSWERSIf the parent class has several
constructors then the one which is invoked is determined by matching argument lists.
Sometimes (as in the example) you want a child class to have its own method, but that method includes
everything the parent's method does. - ANSWERSsuper.show();
show being the method
Object Class - ANSWERSRemember the rule: every constructor starts out with a super() constructor. If
you don't explicitly put it in, then the Java compiler automatically puts it in for you.
All classes have a parent class (a super class) except one. The class at the top of the Java class hierarchy
is called Object. If a class definition does not specify a parent class then it automatically has Object as a
parent class. The compiler automatically assumes, for example:
abstract class - ANSWERSa class that cannot be instantiated but that can be the parent of other classes.
abstract class - ANSWERSin Java is a class that is never instantiated. Its purpose is to be a parent to
several related classes. The children classes inherit from the abstract parent class.
abstract method - ANSWERShas no body. (It has no statements.) It declares an access modifier, return
type, and method signature followed by a semicolon. A non-abstract child class inherits the abstract
method and must define a non-abstract method that matches the abstract method.
abstract child of an abstract parent - ANSWERSdoes not have to define non-abstract methods for the
abstract signatures it inherits. This means that there may be several steps between an abstract base class
to a child class that is completely non-abstract
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller Bensuda. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $8.49. You're not tied to anything after your purchase.