How to print hello world in Scala
Learn, how to print a Hello world program in the Scala language.
- Create a new file called
HelloWorld.scalaand add the following code.
object HelloWorld {
def main(args: Array[String]): Unit = {
println("Hello, world!")
}
}- Now, we need to compile the code by running this command.
scalac HelloWorld.scalaThis above command will generate a java bytecode.
- Run this command to execute the generated bytecode.
scala HelloWorld

