Scala - print functions Code Example

The code for print functions

// Creating an object
object Student {
  // Main method
  def main(args: Array[String]) {
    // Applying console with println
    Console.println("Alexander Ljung")

    // Displays output with no
    // trailing lines
    print("Hello")
    print("_World!")

    // Used for printing a newline
    println()

    // Displays format string
    printf("Lucky number is %d", 108)
  }
}

/*
Output:
Alexander Ljung
Hello_World!
Lucky number is 108
*/
Code by IncludeHelp, on August 8, 2022 03:01

Comments and Discussions!

Load comments ↻






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