01-11-2012, 01:40 PM
Methods for Java
Methods for Java.ppt (Size: 85.5 KB / Downloads: 27)
Course Updates
Recitation Meeting
If you want to change sessions
Send email requesting change
Postmarked by 5:00 PM, Friday, Feb 11
Only first 15 will be accepted
For those that change sessions (only!)
Not picking up papers in recitation will result in loss of 1 point on final course score per week
Exam should be graded and returned next week
Your Program
Accepts input from HTML or JOptionPane
Driven by a parameter from HTML
JOptionPane
Allows you to test your program with different values
HTML Input
Turn in version lets us test faster
Demonstrates decision making
Where does this decision making go?
Ideal Methods
Short
Easy To Understand and Maintain
Be 'pure' accessor or mutator
Be free from side effects
Method Parameters
There are two kinds of data we can provide to Methods
Primitive Data Values
boolean, byte, short, int, long, float, double, char
Objects
Known Classes
Imported Packages
Non-Public classes defined within the file
Public classes within the project directory
The return
Mutators should be of return type void
In these methods we may use return as a statement by itself
Accessor should have a return type
Must have a return statement
The expression following the statement must be the same as the type specified in the method declaration