Hello World in Scala Last Updated : 11 Jul, 2025 Comments Improve Suggest changes Like Article Like Report The Hello World! the program is the most basic and first program when you dive into a new programming language. This simply prints the Hello World! on the output screen. In Scala, a basic program consists of the following: object Main Method Statements or Expressions Example: Scala // Scala program to print Hello World! object Geeks { // Main Method def main(args: Array[String]) { // prints Hello World println("Hello World!") } } Output: Hello World! Explanation: object Geeks: object is the keyword which is used to create the objects. Objects are the instance of a class. Here “Geeks” is the name of the object. def main(args: Array[String]): def is the keyword in Scala which is used to define the function and "main" is the name of Main Method. args: Array[String] are used for the command line arguments. println("Hello World!"): println is a method in Scala which is used to display the Output on console. How to run a Scala Program? To use an online Scala compiler: We can use various online IDE. which can be used to run Scala programs without installing. Using Command-Line: Make sure we have the Java 8 JDK (also known as 1.8). run javac -version in the command line and make sure we see javac 1.8.___ If we don’t have version 1.8 or higher, Install the JDK Firstly, open a text editor Notepad or Notepad++. write the code in the text editor and save the file with (.scala) extension. open the command prompt follow step by step process on your system. // Scala program to print Hello World! object Geeks { // Main Method def main(args: Array[String]) { // prints Hello World println("Hello World!") } } Step 1: Compile above file using scalac Hello.Scala after compilation it will generate a Geeks.class file and class file name is same as Object name(Here Object name is Geeks). Step 2: Now open the command with object name scala Geeks. It will give the result. Using Scala IDE: IDE like IntelliJ IDEA, ENSIME run scala program easily. write the code in the text editor and press to run it. Comment More info A AkshayGulati Follow Improve Article Tags : Scala Scala Scala-Basics Explore OverviewScala Programming Language3 min readIntroduction to Scala7 min readSetting up the environment in Scala3 min readHello World in Scala2 min readBasicsScala Keywords2 min readScala Identifiers3 min readData Types in Scala3 min readVariables in Scala3 min readControl StatementsScala | Decision Making (if, if-else, Nested if-else, if-else if)5 min readScala | Loops(while, do..while, for, nested loops)5 min readBreak statement in Scala3 min readScala | Literals4 min readOOP ConceptsClass and Object in Scala5 min readInheritance in Scala5 min readOperators in Scala11 min readScala Singleton and Companion Objects3 min readScala Constructors4 min readScala | Polymorphism5 min readScala | Multithreading3 min readScala this keyword2 min readMethodsScala | Functions - Basics3 min readAnonymous Functions in Scala2 min readScala | Closures3 min readRecursion in Scala4 min readMethod Overloading in Scala5 min readMethod Overriding in Scala8 min readLambda Expression in Scala4 min readScala Varargs2 min readStringsScala String4 min readScala | String Interpolation3 min readScala | StringContext2 min readRegular Expressions in Scala5 min readStringBuilder in Scala4 min readScala PackagesPackages In Scala4 min readScala | Package Objects3 min readChained Package Clauses in Scala3 min readFile Handling in Scala3 min readScala TraitScala | Traits7 min readScala | Sealed Trait4 min readScala | Trait Mixins3 min readTrait Linearization in Scala5 min readCollectionsScala Lists5 min readScala ListBuffer6 min readListSet in Scala6 min readScala Map5 min readScala | Arrays6 min readScala | ArrayBuffer4 min readScala | Tuple5 min readSet in Scala | Set-13 min readSet in Scala | Set-27 min readBitSet in Scala5 min readHashSet In Scala4 min readStack in Scala3 min readHashMap in Scala3 min readTreeSet in Scala4 min readIterators in Scala5 min readScala | Option3 min read Like