lecture13

# lecture13 - Computer Science 65 Intro to CS March 11, 2008...

This preview shows pages 1–12. Sign up to view the full content.

Computer Science 65 Intro to CS March 11, 2008 Methods (Chapter 5.1-5.4) Scope Local Variables

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Presentations March 11 Angela Bys education/computers in the classroom March 13 David Ehresmann Molecular modeling
Announcements Exam #1 Average: 68.15 (out of 76) Hand back at the end of class No Office Hours Wednesday, March 12th

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Multiple Parameters Methods can contain more than one parameter public static void printSum(int x, int y) { System.out.println(x+y); }
Multiple Parameters Example public class Example { public static void main(String[] args) { printSum(4,5); } public static void printSum(int x, int y) { System.out.println(x+y); } }

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Variables within Methods Variables declared within a method are called _____________ The scope of a local variable is limited to the method public static void printSum(int x, int y) { int sum = x + y; System.out.println(sum); }
Scope A variable’s scope is

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Returning a Value from a Method Data can be passed into a method by way of the parameter variables. Data may also be returned from a method, back to the statement that called it. int num = Integer.parseInt("700");

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 04/02/2008 for the course CS 065 taught by Professor Urness during the Spring '08 term at Drake University .

### Page1 / 30

lecture13 - Computer Science 65 Intro to CS March 11, 2008...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online