Based on feedback from the survey, we will be working on the topics most requested. First, some review on information about Arrays and ArrayLists. Also, if you have not done so yet, MAKE SURE that you have checked the previous posts on how to do a practice demo for the AP exam and make yourself familiar with the procedures necessary to take the test next week!!! You will not have the time to waste figuring it out on the day of the exam itself!!!!!! Included below is a link to examples and practice questions with arrays and array lists. You may ignore the material on two dimensional arrays if you wish as that material will not be on next week's exam. I would like you to read the material and then try the practice multiple choice problems at the end. There is an answer key explaining the correct and incorrect answers at the end of the assignment. Please finish these by Thursday morning, 5/7/20 and email me any questions you may have by Thursday morning. On Thursday afternoon, I will be posting review material on writing methods, classes, and having class level objects interact with each other. There will be a multiple choice assignment on those topics as well as a free response question dealing with Arrays/Arraylists. After that, I will be giving you more free response questions that involve those topics for the remainder of the time we have until the test next Friday. Remember with ArrayLists, the ArrayList implements (reserved word) the List interface. The methods in the list interface are the same as the method in the ArrayList class, but the ArrayList class provides the details on how the methods will work. In practice, when using the ArrayList, you just need to know what ArrayList methods are and how they work. The fact that ArrayList is using the List interface is really more of a behind the scenes thing that will generally not change how you write your code. More details reviewing how an interface works are below. An interface is similar to a class, but it can not be instantiated. It may have fixed constants (field) variables defined in it. It also contains methods, but they are empty. Interfaces just have the method headers indicating the name and parameters needed in some given method(s). Any class that implements an interface must include the specific code that defines how each method will work in that specific class. So for example, say we have a Vehicle Interface that has a method called travel. The travel method header in the interface may have a parameter called route and return a double value called mileage. But there is no code in the method. Three different classes called Auto, Plane, and Boat can IMPLEMENT the travel interface where the specifics on how they travel and plan their route is defined in the individual classes. An auto chooses a land route, a plane chooses an air route and a boat chooses a sea route. But they all call the travel method based on the header defined in the interface. So an interface is basically like a general format or outline of a class where the specific details of how the code works is defined in each individual class that uses(implements) the outline as described by the interface.
Comments are closed.
|