0% found this document useful (0 votes)
19 views15 pages

Methods in Java 2

The document discusses methods in Java, including built-in methods, syntax for basic functions, and understanding method calls. It provides examples such as calculating maximum values, combinations (nCr), permutations (nPr), and finding the HCF or GCD of two numbers. Additionally, it touches on concepts like pass by value and pass by reference.

Uploaded by

agraniabha2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views15 pages

Methods in Java 2

The document discusses methods in Java, including built-in methods, syntax for basic functions, and understanding method calls. It provides examples such as calculating maximum values, combinations (nCr), permutations (nPr), and finding the HCF or GCD of two numbers. Additionally, it touches on concepts like pass by value and pass by reference.

Uploaded by

agraniabha2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Methods

in Java
What and Why?
baar baar Karna hai Kuch -
Loops
Built-In Methods
>
-
Math floor(n)
↓ - E3 8]
.

-
GIF 3 7
.
-
·

- 3
[x] -
1
Oz -
2 -
-

Lad · 1 .
2
--2
-

--3
- · -
3 S
.

--
y

HW Find the of 4 numbers.


max
Input them.
- -
Built-In Methods
a , b, c, d
Syntax and a basic void function

I
Output
-

powerbank
Y
s Router re
eiye ·
Roshan
63 ↑
Ashirwad
I

3
*
7

main method runs


first
Syntax and a basic void function
6 Output

I
-

7 ~

11
·

Ajay
12 ↑
YASHIKA
I
~
·
Khushi
2

14

S
9
10

3
Y

S S

13
Understanding method Calls
Method Arguments
return type
static int fun(inta intb doublec I
public , ,
...

3
jo bui andar hai vo chaldo
-
hai
function be do kaam note
>
- ek value bhiho sakti hai
return type

I
Output
-

bann

Fa
~
- S

-
E
~ - 5

Math.max(a . b) >
- int
Ques: Take ‘n’ and ‘r’ as input and print
nCr and nPr.
- #XEXSX3X2
"G For En : C
-= =
=
=

3 ! x (7-3)! 31x4! 3X2


****
~? x(n r)!
-

= 35

"Pr =
!
(H -2) !
Ques: Take two numbers input and
calculate their HCF or GCD.

L
Recursion me
Karenge
Pass by Value & Pass by Reference

I
Output
-

66
~

W
-
~
⑧ 6
-
Ques: Swap 2 Numbers
THANKYOU
Cuties

You might also like