What is the scope of a local variable in Scala?

50. What is the scope of a local variable in Scala?

  1. Whole program
  2. A method is it declared in
  3. Class/object containing it
  4. All of the above

Answer: B) A method is it declared in

Explanation:

Local variables of methods have scope restricted to that of methods in Scala.

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.