Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Download
Standard view
Full view
of .
Look up keyword
Like this
2Activity
0 of .
Results for:
No results containing your search query
P. 1
05 Slide

05 Slide

Ratings: (0)|Views: 17|Likes:
Published by MohamedFMN

More info:

Published by: MohamedFMN on Oct 25, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PPT, PDF, TXT or read online from Scribd
See more
See less

05/19/2010

pdf

text

original

 
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. Allrights reserved. 0-13-222158-6
1
Chapter 5Methods
 
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. Allrights reserved. 0-13-222158-6
2
Objectives
3
To declare methods, invoke methods, and pass argumentsto a method (§5.2-5.4).
3
To use method overloading and know ambiguousoverloading (§5.5).
3
To determine the scope of local variables (§5.6).
3
To learn the concept of method abstraction (§5.7).
3
To know how to use the methods in the Math class (§5.8).
3
To design and implement methods using stepwiserefinement (§5.10).
3
To group classes into packages (§5.11 Optional).
 
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. Allrights reserved. 0-13-222158-6
3
Introducing Methods
A method is a collection of statements that aregrouped together to perform an operation.
 
public static int max(int num1, int num2) {int result;if (num1 > num2)result = num1;elseresult = num2;return result;}
 
modifier return value typemethod nameformal parametersreturn valuemethod body methodheader   parameter listDefine a methodInvoke a method
int z = max(x, y);
actual parameters(arguments)

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->