Home »
Scala
Scala Programs
Scala is a programming language developed by Martin Odersky. It came into the market in 2003. Scala Stands for Scalable Language. Scala is a JAVA based programming Language which is much easier to code than Java. So is treated as future replacement of Java in enterprise software development.
Scala programs / examples: This section contains solved Scala programs/examples on the various topics such as basic programs, conditions & control statement-based programs, looping programs, array & string programs, structure programs, function & package-based programs, etc. with examinations and outputs.
10 useful Scala solved programs
Scala Programs Index
Scala Basic Programs
- Scala program to print 'Hello World'
- Scala program to create the mutable variable
- Scala program to create an immutable variable
- Scala program to create different types of variables
- Scala program to print the value of variables using printf() function
- More Scala Basic Programs...
Scala User-defined Functions Programs
- Scala program to create a simple function
- Scala program to create a function with arguments
- Scala program to return a value from a function using the 'return' statement
- Scala program to return a value from the function without using the 'return' statement
- Scala program to create a function with default arguments
- More Scala User-defined Functions Programs ...
Scala Looping Programs
- Scala program to print numbers from 1 to 10 using while, do-while, and for loop
- Scala program to implement infinite loop using while and do-while loop
- Scala program to demonstrate the nested while and do-while loop
- Scala program to demonstrate the break statement in while and do-while loop
- Scala program to execute do-while loop at least 1 time on false condition
- More Scala Looping Programs ...
Scala Pattern Matching Programs
- Scala program to demonstrate the match statement
- Scala program to return match case value from a method
- Scala program to read a weekday number and print weekday name using match case
- Scala program to check the given character is vowel and consonant
- Scala program to implement an arithmetic calculator using a match case
- More Scala Pattern Matching Programs ...
Scala Array Programs
- Array Rotation in Scala
- Scala program to find the odd occurrences in an array
- Scala program to create strings array
- Scala program to convert Array to string
- Scala program to convert multiline strings to an array
- More Scala Array Programs ...
Scala String Programs
- Scala program to reverse a string
- How to determine if a string contains a regular expression in Scala?
- Scala program to split string
- Scala program to convert string to integer
- How to count the number of characters in a string in Scala?
- More Scala String Programs ...
Scala Classes & Objects Programs
- Scala program to demonstrate the 'private' access modifier
- Scala program to demonstrate the 'public' access modifier
- Scala program to create a private class
- Scala program to create a private singleton object
- Scala program to create a private case class
- More Scala Classes & Objects Programs ...
Scala Inheritance Programs
- Scala program to implement simple inheritance
- Scala program to implement multilevel inheritance
- Scala program to implement hierarchical inheritance
- Scala program to implement hybrid inheritance
- Scala program to demonstrate the protected access specifier
- More Scala Inheritance Programs ...
Scala Final Variables, Methods & Classes Programs
- Scala program to demonstrate the final data member
- Scala program to demonstrate the final method
- Scala program to demonstrate the final class
- More Scala Final Variables, Methods & Classes Programs ...
Scala Abstract Classes Programs
- Scala program to demonstrate the abstract class
- Scala program to create an abstract class with data members
- Scala program to create an abstract class with the constructor
- Scala program to create an abstract class with the non-abstract method
- Scala program to create an abstract class with the final method
- More Scala Abstract Classes Programs ...
Scala List Programs
- Scala program to demonstrate the List collection
- Scala program to access items of List collection using the index
- Scala program to remove duplicates from list
- How to create a range of characters (Lists, Sequence) in Scala?
- How to get the first element of list in Scala?
- More Scala List Programs ...
Scala Date & Time Programs
- Scala program to print the current time
- Scala program to print the current time in milliseconds
- Scala program to print the current date
- Scala program to print the current date and time using getTime() method
- Scala program to format the current time using SimpleDateFormat class
- More Scala Date & Time Programs ...
Scala Sequence Programs
- Scala program to create a sequence of integers
- Scala program to check a sequence is empty or not
- Scala program to demonstrate the endsWith() method for the sequence of integers
- Scala program to check a given number is exist in a sequence or not
- Scala program to reverse the elements of a sequence
- More Scala Sequence Programs ...
Scala Set Programs
- Scala program to demonstrate the Set collection
- Scala program to iterate set elements using the for loop
- Scala program to iterate set elements using the foreach loop
- Scala program to get the first element of Set using the head property
- Scala program to get all elements of the set except first element using tail property
- More Scala Set Programs ...
Scala Map Programs
- Scala program to store key/value pairs using Map collection
- Scala program to print iterate map using the for loop
- Scala program to add elements to the Map collection
- Scala program to delete elements from the Map collection
- Scala program to check a Map collection is empty
- More Scala Map Programs ...
Scala Vector Programs
- Scala program to demonstrate the Vector collection class
- Scala program to print the vector elements using the foreach loop
- Scala program to print the last element of a vector using the last() method
- Scala program to check a vector is empty or not
- Scala program to add an item into Vector collection
- More Scala Vector Programs ...
Scala Queue Programs
- Scala program to create a queue using Queue collection class
- Scala program to get the first item from the front-end in the queue
- Scala program to add an item in the queue using enqueue() method
- Scala program to delete an item from the queue using dequeue() method
- Scala program to check a queue is empty or not
- More Scala Queue Programs ...
Scala Trait Programs
- Scala program to create a simple trait
- Scala program to extend a trait in a class without implementing the abstract method
- Scala program to create a non-abstract method inside the trait
- Scala program to implement multiple traits in a class
- Scala program to implement trait Mixins
- More Scala Trait Programs ...
Scala Exception Handling Programs
- Scala program to handle Divide By Zero exception
- Scala program to handle multiple exceptions
- Scala program to print exact exception message
- Scala program to demonstrate the finally block
- Scala program to demonstrate the finally block without catch block
- More Scala Exception Handling Programs ...
Scala Threading Programs
- Scala program to print the state of the thread
- Scala program to check a thread is alive or not
- Scala program to set and get the priority of the thread
- Scala program to implement multi-tasking using thread
- Scala program to create a thread by extending Thread class
- More Scala Threading Programs ...
Scala scala.math Package Programs
- Scala program to find the largest number using scala.math.max() function
- Scala program to find the smallest number using scala.math.min() function
- Scala program to perform ceiling operation on given number using scala.math.ceil() function
- Scala program to perform floor operation on given number using scala.math.floor() function
- Scala program to get the natural logarithm of a Double number using scala.math.log() function
- More Scala scala.math Package Programs ...
Scala File Handling Programs
- Scala program to create a file
- Scala program to read data from a text file
- Scala program to read data from a file line by line
- More Scala File Handling Programs ...