java methods Flashcards

(17 cards)

1
Q

blocks of code that perform specific tasks and
are part of a class.

A

methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

They allow code reusability and modularity by
defining a single block of code that can be executed multiple times
by “____” the method.

A

calling

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

they are used to divide and sort Functionalities within in a
class so that the code will readable even if its long.

A

methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

defines the visibility of the method (public,
private, protected, no modifier(Default)).

A

Access Modifier

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The data type of the value the method returns.

A

return type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Use
___ if the method does not return a value.

A

void

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Name of the Java method. Used to call the method.

A

Method Name:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

variable passed to the method for processing.

A

Parameters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

parameter is

A

optional

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

A ___ belongs to the class rather than any instance (object). Therefore, it can be
called directly using the class name, without creating an object.

A

static method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

To call an ___, you first need to create an object of the class where the
method is defined. Then, use the object to call the method.

A

instance method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

The ___ keyword is used to return a value from a method. It is required when a method produces a result. The type of the returned value must match the method’s
specified type.

A

return

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q
  • Use a ___ if the method returns a value (e.g., int, double, String).
A

specific data type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

use ___ if the method does not return anything

A

void

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

_____ in Java occurs when two or more methods in the
same class have the same ___ but different ___.

A

Method overloading, name, parameters

17
Q

___ allows
you to define multiple behaviors for a method while maintaining readability.