{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lec7 - 1.00 Lecture 7 Java Classes and Objects Reading for...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
1.00 Lecture 7 Java Classes and Objects Reading for next time: Big Java: sections 2.6-2.11 Classes A class is a pattern or template from which objects are made You may have many birds in a simulation One bird class (or more if there’s more than one type of bird) Many bird objects (actual instances of birds) Simulation Objects are instances of classes Class: Student Object: Joe Smith Class: Building Object: Building 10 Class: Street Object: Mass Ave
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Class Definition Classes contain: Data (members, fields) Simple data types, like int or double (e.g. bird weight) Objects (e.g. bird beak) Methods (functions, procedures) Actions that an object can execute (e.g. bird flies/moves) Classes come from: Java class libraries: JOptionPane, Array, Math, etc. There are several thousand classes (Javadoc) Class libraries from other sources: Web, fellow students… Classes that you write yourself Classes are usually the nouns in a problem statement (e.g. bird) Data members are also nouns (e.g., weight) Methods are usually the verbs (e.g. flies) Building Classes Classes hide their implementation details from the user (programmer using the already-written class):
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

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