Javatpoint Logo
Javatpoint Logo

Scala Custom Exception

In scala, you can create your own exception. It is also known as custom exceptions. You must extend Exception class while declaring custom exception class. You can create your own exception message in custom class. Let's see an example.

Scala Custom Exception Example

Output:

Exception Occured : InvalidAgeException: Not eligible
Next TopicScala Collection




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA