0% found this document useful (0 votes)
5K views5 pages

Jav 5

Uploaded by

MONICA NAHAK
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)
5K views5 pages

Jav 5

Uploaded by

MONICA NAHAK
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
You are on page 1/ 5

Dt : 22/7/2023

Execution flow of above program:

ii
ath
aip
hM
a tes
nk

==============================================================
Ve

faq:

define Method Frame?

=>The partition of "Java Stack Area" where the method is copied for

execution is known as Method Frame.

=>After Method Execution completed,the method Frame will be destroyed


automatically.

==================================================================

*imp

define parameters?

=>Parameters are the variables which are used to transfer the data from

ii
one method to another method.

ath
=>Based on Parameters the methods are categorized into two types:

(a)Methods without parameters

aip
(b)Methods with parameters.
hM
(a)Methods without parameters:

=>The methods which are declared without parameters are known as

0-parameter methods or Methods without parameters.


tes

Ex:

DemoMethods1.java
a
nk

(b)Methods with parameters:


Ve

=>The methods which are declared with parameters are known as

parameterized methods or Methods with parameters.

-----------------------------------------------------------

*imp

define return_type?
=>return_type will specify the method will return the value after

execution or not

=>Based on return_type methods are categorized into two types:

(a)NonReturn_type methods

(b)Return_type methods

ii
ath
(a)NonReturn_type methods:

=>The methods which will not return any value after method execution

aip
are known as NonReturn_type methods.

Ex:
hM
DemoMethods1.java

=>The methods which are declared with "void" are known as NonReturn_type

methods.
tes

(b)Return_type methods:
a
nk

=>The methods which return the value after execution are known as

Return_type methods.
Ve

=>The methods which are declared witout "void" are known as Return_type

methods,which means "void" is replaced with datatype.

------------------------------------------------------------------

Ex:(Demonstrating Methods with parameters and return_type)


Program : DemoMethods2.java

class Average

float avg(int x,int y)

ii
float z = (float)(x+y)/2;

ath
return z;

aip
}

class DemoMethods2
hM
{

public static void main(String[] args)

{
tes

Average ob = new Average();

float res = ob.avg(12,13);


a
nk

System.out.println("Average="+res);

}
Ve

===================================================================

Assignment:

wap to display percentage of 6 sub marks?


SubClass : Percentage

float per(s1,s2,s3,s4,s5,s6)

MainClass : DemoMethods3

==================================================================

ii
ath
aip
hM
a tes
nk
Ve

You might also like