Question

In: Computer Science

Pick a pair of concrete classes in the JDK in a parent-child relationship and discuss a...

Pick a pair of concrete classes in the JDK in a parent-child relationship and discuss a few polymorphic and/or overloaded methods. Do not use Object as the parent class - it is too trivial to address the issues to be addressed here, and in any case, Object is the final parent of all classes in Java.

Solutions

Expert Solution

    • java.lang.Object
      • java.util.AbstractCollection<E>
        • java.util.AbstractList<E>
          • java.util.ArrayList<Object>
            • javax.management.AttributeList

    Parent Class - Array List

    Child class - Attribute List

    Concrete class :

    public class ArrayList<E>
    extends AbstractList<E>
    implements List<E>, RandomAccess, Cloneable, Serializable
    

    public class AttributeList extends ArrayList<Object>

    Overloaded method :

    In Parent Class -

    boolean   add(E e)
    Appends the specified element to the end of this list.

    void   add(int index, E element)
    Inserts the specified element at the specified position in this list.

    In Child class -

    void   add(Attribute object)
    Adds the Attribute specified as the last element of the list.

    void   add(int index, Attribute object)
    Inserts the attribute specified as an element at the position specified.

    Overriding a method :

    public boolean add(Object element)
    

    Appends the specified element to the end of this list.

    Overrides: add in class ArrayList<Object>


Related Solutions

Why was the quality of the parent-child relationship so important to Erickson? Discuss at least (5)...
Why was the quality of the parent-child relationship so important to Erickson? Discuss at least (5) things that Erickson would have said a parent should do to encourage the basic strengths in a child younger than 11 years of age. Allport: Describe 4 characteristic of a trait. How do traits differ from attitudes? Describe Allport’s concept of functional autonomy. What role does it play in the development of personality? What is the relationship between our motivation(work, love motivation, exercise motivation,...
How does the parent-child relationship change during emerging adulthood?
How does the parent-child relationship change during emerging adulthood?
Design You will need to have at least four classes: a parent class, a child class,...
Design You will need to have at least four classes: a parent class, a child class, a component class, and an unrelated class. The component object can be included as a field in any of the other three classes. Think about what each of the classes will represent. What added or modified methods will the child class have? What added fields will the child class have? Where does the component belong? How will the unrelated class interact with the others?...
Discuss the impact on a family when a middle generation parent is caring for a child...
Discuss the impact on a family when a middle generation parent is caring for a child and an aging parent.
Using pipes for inter-process communications, write a C program to produce a parent/child relationship in which...
Using pipes for inter-process communications, write a C program to produce a parent/child relationship in which the parent process repeatedly counts and displays on the screen the number of characters for any user password the child process inputs to the pipe. The communications should cease once the string “Done” is inputted.
Consider a game between a parent and a child. The child can choose to be good...
Consider a game between a parent and a child. The child can choose to be good (G) or bad (B); the parent can punish the child (P) or not (N). The child get enjoyment worth a 1 from bad behavior, but hurt worth -2 from punishment. Thus, a child who behaves badly and is punished gets 1 - 2 = -1; and so on. The parents gets -2 from the child's bad behavior and -1 from inflicting punishment. (a) Set...
How could you describe this a sensitive child to a parent that feels their child is...
How could you describe this a sensitive child to a parent that feels their child is just shy (a parent that overlooks their child's sensitive behavior)? Without telling the parent they are wrong about their child's behavior?
discuss this please 1. The relationship between the fineness of cement and the resistance to concrete...
discuss this please 1. The relationship between the fineness of cement and the resistance to concrete compression., 2. The maternal heat rate of five types of Portland cement. 3. The development of resistance to pure compounds paste in cement 4, the rate of maternal heat rate, originally, types of Portland cement
Does a more negative reinforcement-based parenting style cause more tension in the parent/child relationship? If so,...
Does a more negative reinforcement-based parenting style cause more tension in the parent/child relationship? If so, how?
Is offering GED classes or English as a second language classes to parent a good idea?
Is offering GED classes or English as a second language classes to parent a good idea?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT