Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall Office hours: M-F 11:00-11:50 645-4739"— 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 overview if-else statement if ( ) else true false

14 Control structure overview if statement if ( ) true false

15 Control structure overview while statement while ( ) true false

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


Download ppt "CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall Office hours: M-F 11:00-11:50 645-4739"

Similar presentations


Ads by Google