scala hello world
Scala Hello World
To write a "Hello, World!" program in Scala, you can use the following code:
object HelloWorld {
def main(args: Array[String]): Unit = {
println("Hello, World!")
}
}
This code defines an object called HelloWorld
with a main
method that takes an array of strings as an argument. Inside the main
method, the program prints "Hello, World!" to the console using the println
function.
You can save this code in a file with a .scala
extension, such as HelloWorld.scala
. Then, you can compile and run the program using the Scala compiler or an integrated development environment (IDE) that supports Scala.
I hope this helps! Let me know if you have any further questions.