1 / 16

CSE115: Introduction to Computer Science I

CSE115: Introduction to Computer Science I. Dr. Carl Alphonce 219 Bell Hall Office hours: M-F 11:00-11:50 645-4739 alphonce@buffalo.edu. Reminders & Announcements. Final exam: Monday, 12/14, 11:45 AM – 2:45 PM CSEUGSA 115/116/250 Exam Review Saturday, 12/12

upton
Download Presentation

CSE115: Introduction to Computer Science I

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall Office hours: M-F 11:00-11:50 645-4739 alphonce@buffalo.edu

  2. Reminders & Announcements • Final exam: • Monday, 12/14, 11:45 AM – 2:45 PM • CSEUGSA • 115/116/250 Exam Review • Saturday, 12/12 • Time – starting at 1:00 PM • Room – Bell 242

  3. Objects • properties • stored in (private) instance variables • behaviors • defined by (public) methods • class definition is “blueprint” for objects • creation • new + constructor • space allocated on heap • yields a reference to the object

  4. Classes • definition = header + body • header • access control modifier • name • extends clause (optional) • implements clause (optional) • body • instance variable declarations • constructor and method definitions • constructor • basic role is to set initial value of each instance variable

  5. Variable declarations • All variable declarations have: • type • name • Instance variable declarations have: • access control modifier • type • name • Local variable/parameter declarations have: • type • name

  6. Scope • instance variable • entire class body • local variable • from point of declaration to end of method (block) • parameter • entire method body

  7. Lifetime • instance variable • same as object • local variable • duration of method call • parameter • duration of method call

  8. Relationships • composition • association • dependency • generalization • implementation

  9. Methods • definition = header + body • header • access control modifier • return type specification (void or typename) • name • parameter list • body • statements and declarations

  10. Method calls • methods are called on objects • need a reference • reference can be new • as in: new Ant().start(); • or pre-existing • as in: a.start(); • assuming: Ant a = new Ant();

  11. Patterns • Holder • Proxy • State

  12. Primitives • primitives are not objects • eight primitive types: • boolean • floating point • float • double • integral • unsigned: char • signed: byte, short, int, long

  13. Control structure overviewif-else statement if ( <expr> ) <stmt1> else <stmt2> <expr> false true <stmt2> <stmt1>

  14. Control structure overviewif statement if ( <expr> ) <stmt> <expr> true <stmt> false

  15. Control structure overviewwhile statement while ( <expr> ) <stmt> <expr> true <stmt> false

  16. Exercises Check out the ControlStructureExamples project from the LectureCode repository.

More Related