

{"id":18380,"date":"2018-06-13T04:10:33","date_gmt":"2018-06-13T04:10:33","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=18380"},"modified":"2021-12-04T10:15:22","modified_gmt":"2021-12-04T04:45:22","slug":"scala-throw-keyword","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/scala-throw-keyword\/","title":{"rendered":"How Can We Use Scala Throw Keyword &#8211; Scala Exception"},"content":{"rendered":"<p>In this tutorial, we will talk about the Scala Throw Keyword. So, in this\u00a0Scala\u00a0Throw\u00a0keyword\u00a0Tutorial, we are going to see how can we Throw Custom Exception in <a href=\"https:\/\/data-flair.training\/blogs\/scala-tutorial\/\"><strong>Scala Programming Language<\/strong><\/a>. Moreover, we will discuss\u00a0Catching Exceptions in Scala.<\/p>\n<p>Let\u2019s begin Sacla Throw Keyword.<\/p>\n<div id=\"attachment_18398\" style=\"width: 1210px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/Scala-Throw-Keyword-01.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-18398\" class=\"wp-image-18398 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/Scala-Throw-Keyword-01.jpg\" alt=\"How Can We Use Scala Throw Keyword - Scala Exception\" width=\"1200\" height=\"628\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/Scala-Throw-Keyword-01.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/Scala-Throw-Keyword-01-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/Scala-Throw-Keyword-01-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/Scala-Throw-Keyword-01-768x402.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/Scala-Throw-Keyword-01-1024x536.jpg 1024w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><p id=\"caption-attachment-18398\" class=\"wp-caption-text\">How Can We Use Scala Throw Keyword &#8211; Scala Exception<\/p><\/div>\n<h3 class=\"western\">How Can We Throw Custom Exceptions in Scala?<\/h3>\n<p>Scala lets you create your own custom exceptions using the Scala Throw Keyword. With this, you can explicitly throw an exception in your code.<br \/>\n<strong><a href=\"https:\/\/data-flair.training\/blogs\/scala-exceptions-handling\/\">Let&#8217;s Get a Clear Information About Scala Exceptions and Exception Handling<\/a><\/strong><br \/>\nLet\u2019s take a simple example.<\/p>\n<pre class=\"EnlighterJSRAW\">scala&gt; def person(age:Int){\r\n| if(age!=15)\r\n| throw new Exception(\"Wait a little\")\r\n| else println(\"Enjoy your quinceanera\")\r\n| }\r\nperson: (age: Int)Unit\r\nscala&gt; person(15)<\/pre>\n<p>Enjoy your quinceanera<\/p>\n<pre class=\"EnlighterJSRAW\">scala&gt; person(14)<\/pre>\n<p>java.lang.Exception: Wait a little<\/p>\n<pre class=\"EnlighterJSRAW\">at .person(&lt;console&gt;:13)\r\n... 28 elided<\/pre>\n<h3 class=\"western\">Scala Throw Keyword<\/h3>\n<p>Now, when we know a method can throw an exception, we may want to tell Scala. We use the Scala throws keyword for this, but we can also place the @throws annotation right before a method.<\/p>\n<pre class=\"EnlighterJSRAW\">@throws(classOf[Exception])\r\noverride def play{\r\n\/\/exception-throwing code\r\n}<\/pre>\n<p>But a method may throw more than one code. To mention all of these, we use multiple <a href=\"https:\/\/data-flair.training\/blogs\/scala-annotations\/\"><strong>annotations in Scala<\/strong><\/a>.<\/p>\n<pre class=\"EnlighterJSRAW\">@throws(classOf[IOException])\r\n@throws(classOf[LineUnavailableException])\r\n@throws(classOf[UnsupportedAudioFileException])\r\ndef playSoundFileWithJavaAudio{\r\n\/\/exception-throwing code\r\n}<\/pre>\n<p>@throws is also a way to provide the method signature for \u2018throws\u2019 to those who work with <a href=\"https:\/\/data-flair.training\/blogs\/java-tutorial\/\"><strong>Java Programming Language<\/strong><\/a>. Java would have the following code for this:<\/p>\n<pre class=\"EnlighterJSRAW\">public void play() throws FooException{\r\n\/\/code\r\n}<\/pre>\n<p><strong><a href=\"https:\/\/data-flair.training\/blogs\/scala-constructor\/\">Do you Know 2 Popular Types of Constructors in Scala<\/a><\/strong><\/p>\n<h3>More On Throw Keyword in Scala<\/h3>\n<p>Talking about checked exceptions, Scala doesn\u2019t need methods to declare that they can throw exceptions. In Scala, all exceptions are <i>RuntimeException<\/i>s, and it is the developer who must decide when to handle them. It doesn\u2019t force us to handle these exceptions.<\/p>\n<pre class=\"EnlighterJSRAW\">scala&gt; def demo{\r\n| throw new Exception\r\n| }<\/pre>\n<p>demo: Unit<br \/>\nWe don\u2019t even need to call these methods to catch the exceptions.<\/p>\n<pre class=\"EnlighterJSRAW\">scala&gt; demo\r\njava.lang.Exception\r\nat .demo(&lt;console&gt;:12)\r\n... 28 elided<\/pre>\n<p>But we must test for them if we want our code to work fine:<\/p>\n<pre class=\"EnlighterJSRAW\">scala&gt; object Demo extends App{\r\n| def demo{\r\n| throw new Exception}\r\n| println(\"After demo\")\r\n| demo\r\n| \/\/Code never executed\r\n| println(\"After demo\")\r\n| }<\/pre>\n<p>defined object Demo<br \/>\n<strong><a href=\"https:\/\/data-flair.training\/blogs\/scala-regex\/\">Read about Scala Regular Expressions \u2013 Replacing Matches<\/a><\/strong><\/p>\n<h3 class=\"western\">Catching Exceptions in Scala<\/h3>\n<p>In the following example, we throw an exception and then have a wildcard pattern case catch it. This pattern catches any exception of the kind throwable.<\/p>\n<pre class=\"EnlighterJSRAW\">scala&gt; try{\r\n| throw new Exception(\"Failed\")\r\n| } catch{\r\n| \/\/catching all Throwable exceptions\r\n| case _:Throwable=&gt;println(\"An exception occurred\")\r\n| }<\/pre>\n<p>An exception occurred<\/p>\n<h3 class=\"western\">Example- Exceptions With Pattern Matching<\/h3>\n<p>Let\u2019s take another example. Here, we combine <a href=\"https:\/\/data-flair.training\/blogs\/scala-pattern-matching\/\"><strong>pattern-matching<\/strong> <\/a>with <a href=\"https:\/\/data-flair.training\/blogs\/scala-exceptions-handling\/\"><strong>exception handling<\/strong><\/a>. This is a bit like the previous example.<\/p>\n<pre class=\"EnlighterJSRAW\">scala&gt; import java.net.URL\r\nimport java.net.URL\r\nscala&gt; import java.net.MalformedURLException\r\nimport java.net.MalformedURLException\r\nscala&gt; import java.io.IOException\r\nimport java.io.IOException\r\nscala&gt; try{\r\n| val url=new URL(\"http:\/\/data-flair.training\")\r\n| }catch{\r\n| case e:MalformedURLException=&gt;println(\"Bad URL \"+e)\r\n| case e:IOException=&gt;println(\"An IO issue \"+e)\r\n| case _:Throwable=&gt;println(\"Something else\")\r\n| }finally{\r\n| \/\/cleanup\r\n| }<\/pre>\n<p><strong><a href=\"https:\/\/data-flair.training\/blogs\/scala-singleton-object\/\">Let&#8217;s Explore Scala Singleton &amp; Scala Companion Object<\/a><\/strong><br \/>\nSo, this was all about Scala Throw Keyword. Hope you like our explanation.<\/p>\n<h3>Conclusion<\/h3>\n<p>Hence, in this Scala Throw tutorial, we have seen how we can throw custom exceptions in Scala. Drop your queries in the comments.<br \/>\nRelated Topic-\u00a0\u00a0<strong><a href=\"https:\/\/data-flair.training\/blogs\/scala-abstract-class\/\">How to Implement Scala Abstract Class with Examples<\/a><\/strong><br \/>\n<strong><a href=\"https:\/\/www.scala-lang.org\/\">For reference<\/a><\/strong><span hidden class=\"__iawmlf-post-loop-links\" data-iawmlf-links=\"[{&quot;id&quot;:1904,&quot;href&quot;:&quot;https:\\\/\\\/www.scala-lang.org&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20251206135355\\\/https:\\\/\\\/www.scala-lang.org\\\/&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2025-12-10 07:41:44&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-15 07:30:15&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-18 15:55:26&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-23 02:56:25&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-27 16:24:45&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-02 02:40:17&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-05 13:44:47&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-09 08:06:50&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-12 14:24:57&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-17 17:26:33&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-20 17:57:07&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-24 15:52:31&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-30 14:21:46&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-02 14:58:48&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-05 16:39:16&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-12 17:17:04&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-16 04:52:29&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-19 13:39:29&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-24 17:10:42&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-28 04:44:36&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-03 07:25:17&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-08 21:46:06&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-12 18:02:22&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-27 20:15:27&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-05 11:05:11&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-10 19:22:51&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-14 07:59:07&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-17 16:14:10&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-21 23:18:28&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-26 09:13:01&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-29 14:23:58&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-07 12:16:25&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-13 10:20:22&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-18 15:54:26&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-22 05:55:10&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-25 08:30:39&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-29 13:12:38&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-02 14:06:47&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-09 18:23:27&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-15 16:29:46&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-19 06:54:54&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-22 13:14:32&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-26 04:09:02&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-29 09:04:33&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-07-03 02:40:11&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-07-06 20:59:35&quot;,&quot;http_code&quot;:206}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-07-06 20:59:35&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;}]\"><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, we will talk about the Scala Throw Keyword. So, in this\u00a0Scala\u00a0Throw\u00a0keyword\u00a0Tutorial, we are going to see how can we Throw Custom Exception in Scala Programming Language. Moreover, we will discuss\u00a0Catching Exceptions&#46;&#46;&#46;<\/p>\n","protected":false},"author":6,"featured_media":18398,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[61],"tags":[12408,12440,12441,12543,12561,12562,12563,12564,12565],"class_list":["post-18380","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scala","tag-scala-catch-exception","tag-scala-exception-handling","tag-scala-exception-types","tag-scala-rethrow-exception","tag-scala-throw-checked-exception","tag-scala-throw-exception-in-match","tag-scala-throw-keyword","tag-scala-throw-runtime-exception","tag-scala-throws-exception"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How Can We Use Scala Throw Keyword - Scala Exception - DataFlair<\/title>\n<meta name=\"description\" content=\"Scala Throw Keyword tutorial-Throw Custom Exceptions in Scala,Can We Checked Excpetion Throw Keyword in Scala,Example of Exceptions With Pattern Matching\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/scala-throw-keyword\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How Can We Use Scala Throw Keyword - Scala Exception - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Scala Throw Keyword tutorial-Throw Custom Exceptions in Scala,Can We Checked Excpetion Throw Keyword in Scala,Example of Exceptions With Pattern Matching\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/scala-throw-keyword\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-06-13T04:10:33+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-12-04T04:45:22+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/Scala-Throw-Keyword-01.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How Can We Use Scala Throw Keyword - Scala Exception - DataFlair","description":"Scala Throw Keyword tutorial-Throw Custom Exceptions in Scala,Can We Checked Excpetion Throw Keyword in Scala,Example of Exceptions With Pattern Matching","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/scala-throw-keyword\/","og_locale":"en_US","og_type":"article","og_title":"How Can We Use Scala Throw Keyword - Scala Exception - DataFlair","og_description":"Scala Throw Keyword tutorial-Throw Custom Exceptions in Scala,Can We Checked Excpetion Throw Keyword in Scala,Example of Exceptions With Pattern Matching","og_url":"https:\/\/data-flair.training\/blogs\/scala-throw-keyword\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-06-13T04:10:33+00:00","article_modified_time":"2021-12-04T04:45:22+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/Scala-Throw-Keyword-01.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/scala-throw-keyword\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/scala-throw-keyword\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89"},"headline":"How Can We Use Scala Throw Keyword &#8211; Scala Exception","datePublished":"2018-06-13T04:10:33+00:00","dateModified":"2021-12-04T04:45:22+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/scala-throw-keyword\/"},"wordCount":433,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/scala-throw-keyword\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/Scala-Throw-Keyword-01.jpg","keywords":["scala catch exception","Scala Exception Handling","scala exception types","scala rethrow exception","scala throw checked exception","scala throw exception in match","Scala Throw Keyword","scala throw runtime exception","scala throws exception"],"articleSection":["Scala Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/scala-throw-keyword\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/scala-throw-keyword\/","url":"https:\/\/data-flair.training\/blogs\/scala-throw-keyword\/","name":"How Can We Use Scala Throw Keyword - Scala Exception - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/scala-throw-keyword\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/scala-throw-keyword\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/Scala-Throw-Keyword-01.jpg","datePublished":"2018-06-13T04:10:33+00:00","dateModified":"2021-12-04T04:45:22+00:00","description":"Scala Throw Keyword tutorial-Throw Custom Exceptions in Scala,Can We Checked Excpetion Throw Keyword in Scala,Example of Exceptions With Pattern Matching","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/scala-throw-keyword\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/scala-throw-keyword\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/scala-throw-keyword\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/Scala-Throw-Keyword-01.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/Scala-Throw-Keyword-01.jpg","width":1200,"height":628,"caption":"How Can We Use Scala Throw Keyword - Scala Exception"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/scala-throw-keyword\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Scala Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/scala\/"},{"@type":"ListItem","position":3,"name":"How Can We Use Scala Throw Keyword &#8211; Scala Exception"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"The DataFlair Team provides industry-driven content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our expert educators focus on delivering value-packed, easy-to-follow resources for tech enthusiasts and professionals.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam2\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/18380","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=18380"}],"version-history":[{"count":6,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/18380\/revisions"}],"predecessor-version":[{"id":104733,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/18380\/revisions\/104733"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/18398"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=18380"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=18380"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=18380"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}