CMSC 10200 - PowerPoint PPT Presentation

1 / 10
About This Presentation
Title:

CMSC 10200

Description:

Different kinds of errors (run-time, compile-time, logic errors) ... Questions, find errors in code, write small bits of code, evaluate/interpret code ... – PowerPoint PPT presentation

Number of Views:21
Avg rating:3.0/5.0
Slides: 11
Provided by: peopleCs
Category:
Tags: cmsc | logic | questions

less

Transcript and Presenter's Notes

Title: CMSC 10200


1
Programming the WWW II
  • CMSC 10200
  • Spring 2003
  • Lecture 3

2
More about methods and classes
  • Exam information
  • Debugging information
  • Overloading
  • Decomposition
  • Relationships -- association aggregation
  • Applets and graphics

3
Debugging information
  • Different kinds of errors (run-time,
    compile-time, logic errors)
  • When debugging applets, appletviewer can give you
    run-time error messages that are difficult to get
    from a browser

4
Exam
  • Thursday
  • Read texts, notes, quizzes
  • Questions, find errors in code, write small bits
    of code, evaluate/interpret code

5
Method overloading
  • A class may have multiple methods of the same
    name but different parameter lists
  • The parameters may differ in number and/or type
  • Similar operations on different types
  • The return types may also vary

6
Overloading in Java
  • Java uses overloading in its standard libraries
  • Ex. System.out.println, Math.abs
  • You may create your own overloaded methods
  • Ex overloaded constructors, overloaded math ops

7
Decomposition
  • Procedural decomposition is the process of
    breaking a complicated task down into smaller
    pieces.
  • In Java, one complicated method may be rewritten
    as a simple method that invokes other methods to
    handle the pieces
  • Example Bank account withdrawal

8
Object relationships
  • Association/use (is aware of)
  • Aggregation (has a)
  • Inheritance (is a) (more on this later)

9
Association
  • Weve seen this -- PairOfDice is aware of Die,
    etc.
  • We can also have relation between instances of
    the same class
  • String methods (concat,equals,etc)

10
Rational Number class
  • Aggregation encapsulation of data
  • Associates objects of same class
  • How do we handle divide by zero? Doing this in a
    nice way is a big question in computer
    science!!!
  • We can aggregate objects as well as primitive data
Write a Comment
User Comments (0)
About PowerShow.com