Presentation is loading. Please wait.

Presentation is loading. Please wait.

Modularity. Methods & Class as program unit A method is comprised of statement sequences and is often viewed as the smallest program unit to be considered.

Similar presentations


Presentation on theme: "Modularity. Methods & Class as program unit A method is comprised of statement sequences and is often viewed as the smallest program unit to be considered."— Presentation transcript:

1 Modularity

2 Methods & Class as program unit A method is comprised of statement sequences and is often viewed as the smallest program unit to be considered as a subprogram. It is self-contained and designed for a particular task which represents an object behavior.

3 Object & Class properties Properties defined in a class can be distinguished into object and class proper- ties. Object properties are definitions that are specific to objects and apply to all objects from the same class. Class properties, on the other hand, apply only to the class even though the structure and behavior of objects of a class is defined by the class.

4 Counting Instance

5 Alternative Counting Instance

6 State of Objects

7 Share Attributes with static

8

9 Class Attributes The static variable count is also known as a class attribute. While a class definition specifies the structure and behavior of objects within, it may have its own attribute and method definitions.

10 Class Methods

11

12 Controlling Visibility

13

14 Packages While class definitions are practical modular units, the Java programming language has another mechanism that facilitates programming teams and reusable software units. The package facility allows for appropriate classes to be grouped into packages. As with standard design rationale for objects where relevant methods are placed in the same class definition, packages in Java form the next level of software containment for classes with logically related functionality.

15 Packages

16 Import keyword


Download ppt "Modularity. Methods & Class as program unit A method is comprised of statement sequences and is often viewed as the smallest program unit to be considered."

Similar presentations


Ads by Google