This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: 10:15 AM CS 107 Fall 2011 Page 1 a. Pass and catch same number & type of parameters b. When using a method call in place of a value, then that method must return a value that fits c. To share variables among methods, declare at the top of the class. These are called instance variables , a.k.a. class variables or fields for the class. [See code for swap.java developed during class] Mechanisms: • ○ "You can look out of a box, but not into a box" Think of the scope of methods, which is an issue when parameters in different parts of your program have the same name. [See other document under today's notes for Confuse.java] Scope How similar can two methods be? Can they have the same name? [See the program getNext.java developed in class] Overloading CS 107 Fall 2011 Page 2...
View Full Document
- Fall '11
- Computer Programming, Subroutine, Class Notes CS, previous in-lab exam, a.k.a. class variables, decimal places System.out.printf