0% found this document useful (0 votes)
31 views6 pages

User Define Method

The document discusses user-defined methods in Java including their definition, parameters, return types, access modifiers, and overloading. It provides examples of method declarations and usages as well as questions to test the understanding of key concepts.

Uploaded by

vickroid007
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)
31 views6 pages

User Define Method

The document discusses user-defined methods in Java including their definition, parameters, return types, access modifiers, and overloading. It provides examples of method declarations and usages as well as questions to test the understanding of key concepts.

Uploaded by

vickroid007
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/ 6

Chapter 4

User-Defined Methods

Mental Drill

a. Interface b. Reusability

Ans. b. Reusability

a. int b. no-return

Ans. c.

Ans. a.

a. Formal parameter b. Actual parameter

Ans. a. Formal parameter

Ans. b.

Ans. a.

Ans. a. 1
Ans. a.

Ans. a.

a. public b. private

Ans. c.

B. Fill in the blanks.


methods.
class.
.
prototype.
formal arguments.
actual
arguments.
void.
value

reference.
overloading.

SECTION A
1.
Ans.

129
2.
Ans.
3.
Ans.
4.
Ans.
5. Name the keyword that causes the control to transfer back to the method call.
Ans. return
6.
Ans.
7.
Ans.
8.
Ans.

Formal Parameters Actual Parameters

They are only variables. They may be both variables or constants.

9.
Ans.

list.
10.
Ans.

11.
Ans.

Call by Reference
Using this technique a copy of the values in Using this technique a reference to the values

parameters. parameters.
parameters.

call by value. by reference.

12.
(i)
Ans.

13.
Ans.

careful using it.

14.
Ans.

else

else

131
else

15.
Ans.
16.

Ans.
17.
Ans.
18.
Ans.
19.
Ans.
operator.

1. Private access method sum which accepts three int type variables as parameters and return a

Ans.
2. Default access method “length” which accepts a String type variable as parameter and returns
an int type.
Ans.
3. Public access method “increment” which accepts an object of Myclass type as parameter and
does not return any value.
Ans.
4.
parameters and have a byte type as return type.
Ans.
5.

Ans.
6.

Ans.
7.
a value which is either ‘true’ or false’.
Ans.

1.

int y = 2;

int a= 6;

Ans.

133

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy