1 / 13

Introduction to Object-Oriented Programming with Java

Introduction to Object-Oriented Programming with Java. Lecture 21: Supporting Material Dr Kathryn Merrick Thursday May 28 th , 2009. Overview. Object-oriented design Object-oriented programming Introduction to Java. Activity 1: O-O Design. Object-Oriented Languages.

ludlow
Download Presentation

Introduction to Object-Oriented Programming with Java

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. Introduction to Object-Oriented Programming with Java Lecture 21: Supporting Material Dr Kathryn Merrick Thursday May 28th, 2009

  2. Overview • Object-oriented design • Object-oriented programming • Introduction to Java

  3. Activity 1: O-O Design

  4. Object-Oriented Languages • Two main levels of encapsulation: • Functions/Methods • Classes/Objects • Classes permit related methods to be: • Grouped together in a logical way • Accessed in a uniform way • Classes can themselves be organised in a hierarchy

  5. First Java Programs – Lego Insects Snail Ant Bee Cricket

  6. Class Inheritance Hierarchy

  7. The Insect Abstract Class Class comment Class header Properties to be inherited by all child classes Methods to be defined by all child classes

  8. The Snail Class Start point for program Constructor

  9. The Cricket run() method Method comment Method header Constant For loop If selection Method call to method in another class

  10. The Ant: Using Helper Methods Calls to helper methods (in same class) Helper methods

  11. The Bee: Simple Vision Revisited

  12. Summary • After this lecture you should be able to define: • Classes/objects • Inheritance • Constructors • Dot operator for method calls • Modifiers • And have an awareness of the differences between Java and Matlab

More Related