The output of the following block of code is | Scala Question 11

81. The output of the following block of code is -

object Demo {
    def sub( a:Int, b:Int ) = {
        println( (a-b) );
    }
    def main(args: Array[String]) {
        sub(b = 5, a = 7);
    }
}
  1. -2
  2. 2
  3. Error
  4. None of these

Answer: B) 2

Explanation:

Named arguments are passed and used.

Comments and Discussions!

Load comments ↻






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