chap 5 Flashcards
What are the benefits of using methods in programming?
- Code can be reused.
- Programs can be simplified.
- Problems are solved more easily.
Any method that calls a method with a throws clause in its head must _____
have the same throws clause
True or False: any value stored in a local variable is lost between calls to the method in which the variable is declared.
True
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
- 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
True or false: In the method header, the method modifier public means that the method belongs to the class, not a specific object.
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.
All @param tags in a method’s documentation must _____
appear before the method header
what is implicit conversion?
the automatic conversion of a value from one data type to another
ex: using byte argument for an int parameter.