Explain the process of initializing an object

Assignment Help JAVA Programming
Reference no: EM13836048

1. Which method is invoked in a particular class when a method definition is overridden in several classes that are part of an inheritance hierarchy? Answer the question for the case in which the class has a definition for the method and also for the case where it doesn't.

2. Explain how assignments can be made within a class hierarchy and the role of casting in a class hierarchy. What is strong typing: Why is it an important language feature?

3. If Java encounters a method call of the following form:

superclassVar . met hodNarne

where superclassVar is a variable of a superclass that references an object whose type is a subclass, what is necessary for this statement to compile? During run time, will method methodName from the class that is the type of superclassVar always be invoked, or is it possible that a different method methodName will be invoked? Explain your answer.

4. Assume the situation in Question 3, but method methodName is not defined in the class that is the type of superclassVar, though it is defined in the subclass type. Rewrite the method call so that it will compile.

5. Explain the process of initializing an object that is a subclass type in the subclass con¬structor. What part of the object must be initialized first? How is this done?

6. 'What is the difference between the size and the capacity of an ArrayList? Why might we have a constructor that lets us set the initial capacity?

7. What is the difference between the remove (Object obj) and renove(int index) methods?

8. When we insert an item into an ArrayList, why do we start shifting at the last element?

9. The Vector and ArrayList both provide the same methods, since they both imple¬ment the List interface. The Vector has some additional methods with the same func¬tionality but different names. For example, the Vector addElement and add methods have the same functionality. There are some methods that are unique to Vector. Look at the Java API documentation and make a list of the methods that are in Vector that have equivalent methods in ArrayLi st and ones that are unique. Can the unique methods be implemented using the methods available in ArrayLi st?

10. If a loop processes n items and n changes from 1024 to 2048, how does that affect the running time of a loop that is 0(n2)? How about a loop that is 0(log n)? How about a loop that is 0(n log n)?

11. A veterinary office wants to store information regarding the kinds of animals it treats. Data includes diet, whether the animal is nocturnal, whether its bite is poisonous (as for some snakes), whether it flies, and so on. Use a superclass Pet with abstract methods and create appropriate subclasses to support about 10 animals of your choice.

12. A student is a person, and so is an employee. Create a class Person that has the data attributes common to both students and employees (name, social security number, age, gender, address, and telephone number) and appropriate method definitions. A student has a grade-point average (GM), major, and year of graduation. An employee has a department, job title, and year of hire. In addition, there are hourly employees (hourly rate, hours worked, and union dues) and salaried employees (annual salary). Define a class hierarchy and write an application class that you can use to first store the data for an array of people and then display that information in a meaningful way.

13. Develop a program to maintain a list of homework assignments. When an assignment is assigned, add it to the list, and when it is completed, remove it. You should keep track of the due date. Your program should provide the following services:
• Add a new assignment.
• Remove an assignment.
• Provide a list of the assignments in the order they were assigned.
• Find the assignment(s) with the earliest due date.

14. Write a program to manage a list of students waiting to register for a course as described in Section 2.5. Operations should include adding a new student at the end of the list, adding a new student at the beginning of the list, removing the student from the beginning of the list, and removing a student by name.

Reference no: EM13836048

Questions Cloud

Compare australia with any other advanced economy : Compare Australia with any other advanced economy and discuss their GDP last 2 to 5 years and factors affecting their GDP
How did the conflict in cora unashamed affect cora : How did the conflict in Cora unashamed affect cora
What is the southwest business model : What is the Southwest business model and why is it so effective? Is the "Continental Lite" and "Shuttle by United" achieving their objective of matching Southwest's price and service offering
Explain why we obseve flat upward sloping and inverted yield : State whether the following statements are True, False or Uncertain. Provide a short justification for your answer. (i) Bond A is a 5­year bond with a 9% coupon rate and a YTM of 9%. Bond B is a 15­year bond with a 8% coupon rate and a YTM of 10%. Bo..
Explain the process of initializing an object : Which method is invoked in a particular class when a method definition is overridden in several classes that are part of an inheritance hierarchy
Articulates the scens purpose and theme or argument : articulates the scene's purpose, theme or argument
How to create a format of a memo : Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 ..
The impact on equilibrium price and quantity of membership : Explain, with the use of demand and supply diagrams, the impact on equilibrium price and quantity of membership to health clubs from the simultaneous impact of an effective advertising campaign by the National Health Council and the reduction of comp..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd