chap7-schedule.docx - chap 7 Objection interaction an...

  • No School
  • AA 1
  • 5

This preview shows page 1 - 2 out of 5 pages.

chap 7 Objection interaction: an introduction Objectives Learn the meaning of Java keyword null Learn how to create a collection of objects using Java class List Know that List is a collection type of class, and it is also the static binding (generic programming) under the context of polymorphism Learn how to use for-each loop, and what is the difference between for-each and a regular for loop Know how to define and use superclass (parent class) and subclass (child class) Schedule: This lesson covers Moodle folder “chap 7”. Please follow the steps below. 1, work on sec 7.1 ~ 7.10, which include scenario autumn-1 and autumn-2. 2, notice the difference between for-each loop and a regular for loop: for-each loop is easier to write, because the navigation of the array is done automatically. for-each loop has to go through every element in the array, and a regular while loop/for loop allows you to skip certain elements because there is a loop control variable in them that you can play with, such as statement for(int i=0; i< 10; i+=2) will skip the odd index element in the array. for-each loop actually makes a copy of the next element in the array, and then manipulate on the element copy in the loop body. Thus you cannot modify the array with for-each loop, because even if you modify the element copy, it will not affect the original array element. In comparison, the regular for loop/while loop can modify any element in the array. 3, in a collection type such as List, we need to plug in another data type such as Leaf inside the pair of < >, to make List a concrete class. The collection class with angle bracket <> is one form of polymorphism called: generic programming, because plugging different classes into < > results in different concrete classes, thus List itself is generic, and it is not attached to any particular class. Generic programming is also called static binding. Please refer to file “chap1-schedule.docx”, the last page, and see the different context of polymorphism. Static binding is one context of polymorphism. 4, work on textbook exercises 7.15, 7.16, 7.17 and 7.18. These exercises are not homework assignment for this week, but it is important to finish them, so that you can get a better understanding of the generic program concept in this chapter. You need to first open the existing scenario “autumn-2” in this chapter, then start working on exercise 7.15. There is a bonus homework assigned for chapter 7. Refer to file “bonusHomework-autumnClick.docs” for detail explanation. Follow the instructions in this document, in order to work on this bonus homework.
Image of page 1

Subscribe to view the full document.

Image of page 2

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes