JAVA METHODS Flashcards

(14 cards)

1
Q

are blocks of code that perform specific tasks and
are part of a class. They allow code reusability and modularity by
defining a single block of code that can be executed multiple times
by “calling” the method.

A

METHODS

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

THEY ARE USED TO DIVIDE AND FUNCTIONALITIES WITHIN 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
3
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
4
Q

The data type of the value the method returns. Use void if the method does not return a value.

A

return type

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

If the method does not return a value, use –

A

VOID

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
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
7
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
8
Q

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
9
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
10
Q

a value that needs to be NOT passed on method so that the method can use that value and perform various operation on it. TRUE OR FALSEW?

A

FALSE, CAN PASSED

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

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 return type.

A

return keyword

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q
  • Use a– if the method returns
A

specific data type

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

in Java occurs when two or more methods in the
same class have the same name but different parameters.

A

Method overloading

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

Overloading allows you to define one behavior for a method while maintaining readability. TRUE OR FALSE?

A

multiple behaviors

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