chap 5 Flashcards

1
Q

What are the benefits of using methods in programming?

A
  • Code can be reused.
  • Programs can be simplified.
  • Problems are solved more easily.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Any method that calls a method with a throws clause in its head must _____

A

have the same throws clause

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

True or False: any value stored in a local variable is lost between calls to the method in which the variable is declared.

A

True

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

Select all that apply: local variables are ____
* are hidden from other methods
* cannot be changed once they are given a value in the method where they exist
* may have the same name as local variables in other methods
* lost the values stored in them between calls to the method in which the variable is declared

A
  • are hidden from other methods
  • may have the same name as local variables in other methods
  • lose the values stored in them between calls to the method in which the variable is declared
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

True or false: In the method header, the method modifier public means that the method belongs to the class, not a specific object.

A

False. In the method header, the public modifier means that the method is accessible from outside the class. It doesn’t imply that the method belongs to the class itself; rather, it indicates that the method can be called from any other class. Methods with the public modifier are part of the class’s interface and can be invoked by objects of that class or objects of other classes.

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

All @param tags in a method’s documentation must _____

A

appear before the method header

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

what is implicit conversion?

A

the automatic conversion of a value from one data type to another
ex: using byte argument for an int parameter.

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