Scala is functional programming language. Except for the side effects that have a return type of Unit or (), everything else returns a value in scala. Scala treats everything as an expression and that is what makes scala such a powerful language. Scala is quite popular in the community because it treats everything as an expression returning a value.

Exception handling in Scala behaves exactly like Java and works seamlessly with existing Java libraries. The difference is in its implementation in Scala. There are only “unchecked” exceptions in Scala. Also, throwing an exception is same as we do in Java. We create an object and use the throw keyword to throw the exception. The difference appears when trying to catch these exceptions.

#java #scala #exceptions #scala vs java

Exception handling in Scala
1.20 GEEK