CSE115 Computer Science Exam Review
160 likes | 263 Vues
Join us for the CSE115 exam review session on Saturday, 12/12, at Bell 242. Learn about objects, classes, variables, relationships, methods, control structures, and more from Dr. Carl Alphonce. Prepare for the final exam and enhance your understanding of computer science concepts.
CSE115 Computer Science Exam Review
E N D
Presentation Transcript
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 • Time – starting at 1:00 PM • Room – Bell 242
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
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
Variable declarations • All variable declarations have: • type • name • Instance variable declarations have: • access control modifier • type • name • Local variable/parameter declarations have: • type • name
Scope • instance variable • entire class body • local variable • from point of declaration to end of method (block) • parameter • entire method body
Lifetime • instance variable • same as object • local variable • duration of method call • parameter • duration of method call
Relationships • composition • association • dependency • generalization • implementation
Methods • definition = header + body • header • access control modifier • return type specification (void or typename) • name • parameter list • body • statements and declarations
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();
Patterns • Holder • Proxy • State
Primitives • primitives are not objects • eight primitive types: • boolean • floating point • float • double • integral • unsigned: char • signed: byte, short, int, long
Control structure overviewif-else statement if ( <expr> ) <stmt1> else <stmt2> <expr> false true <stmt2> <stmt1>
Control structure overviewif statement if ( <expr> ) <stmt> <expr> true <stmt> false
Control structure overviewwhile statement while ( <expr> ) <stmt> <expr> true <stmt> false
Exercises Check out the ControlStructureExamples project from the LectureCode repository.