{"id":25524017,"date":"2022-05-20T21:47:50","date_gmt":"2022-05-20T16:17:50","guid":{"rendered":"https:\/\/entri.app\/blog\/?p=25524017"},"modified":"2022-11-20T06:46:11","modified_gmt":"2022-11-20T01:16:11","slug":"difference-between-throw-and-throws-in-java","status":"publish","type":"post","link":"https:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/","title":{"rendered":"Difference Between Throw and Throws in Java"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_79_2 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69e5ec7b9471d\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69e5ec7b9471d\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/#What_is_Throw_in_Java\" >What is Throw in Java?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/#What_is_Throws_in_Java\" >What is Throws in Java?<\/a><\/li><\/ul><\/nav><\/div>\n<p>Talking about throw and throws, both are the concepts of exception handling. Throw is used to explicitly throw an exception from a method or any block of code. On the other hand, throws are used in the signature of the method to indicate that this method might throw one of the listed type exceptions.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"What_is_Throw_in_Java\"><\/span><strong>What is Throw in Java?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Throw keyword in java\u00a0is used to throw an exception explicitly and logically defined by the programmer during the program control moves from one block to another assuming the errors exception are defined and handled accordingly.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"What_is_Throws_in_Java\"><\/span><strong>What is Throws in Java?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Throws is used to declare and call an exception block, which means its working is similar to the try-catch block.<\/p>\n<p style=\"text-align: center;\"><strong><a href=\"https:\/\/bit.ly\/3ELmCiA\" target=\"_blank\" rel=\"noopener\">Learn Coding in your Language! Enroll Here!<\/a><\/strong><\/p>\n<h3><strong>Differences between throw and throws<\/strong><\/h3>\n<p>Let us look at table given below to have a clear look at what are the differences between throw and throws in Java:<\/p>\n<table dir=\"ltr\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<colgroup>\n<col width=\"100\" \/>\n<col width=\"100\" \/>\n<col width=\"100\" \/>\n<col width=\"100\" \/><\/colgroup>\n<tbody>\n<tr>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Sr. no.&quot;}\"><strong>Sr. no.<\/strong><\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Basis of Differences&quot;}\"><strong>Basis of Differences<\/strong><\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;throw&quot;}\"><strong>throw<\/strong><\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;throws&quot;}\"><strong>throws<\/strong><\/td>\n<\/tr>\n<tr>\n<td data-sheets-value=\"{&quot;1&quot;:3,&quot;3&quot;:1}\">1<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Definition&quot;}\">Definition<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Java throw keyword is used throw an exception explicitly in the code, inside the function or the block of code.&quot;}\">Java throw keyword is used throw an exception explicitly in the code, inside the function or the block of code.<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Java throws keyword is used in the method signature to declare an exception which might be thrown by the function while the execution of the code.&quot;}\">\n<div>\n<div>Java throws keyword is used in the method signature to declare an exception which might be thrown by the function while the execution of the code.<\/div>\n<\/div>\n<\/td>\n<\/tr>\n<tr>\n<td data-sheets-value=\"{&quot;1&quot;:3,&quot;3&quot;:2}\">2<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Type of exception Using throw keyword, we can only propagate unchecked exception i.e., the checked exception cannot be propagated using throw only.&quot;}\">Type of exception Using throw keyword, we can only propagate unchecked exception i.e., the checked exception cannot be propagated using throw only.<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Using throws keyword, we can declare both checked and unchecked exceptions. However, the throws keyword can be used to propagate checked exceptions only.&quot;}\">\n<div>\n<div>Using throws keyword, we can declare both checked and unchecked exceptions. However, the throws keyword can be used to propagate checked exceptions only.<\/div>\n<\/div>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td data-sheets-value=\"{&quot;1&quot;:3,&quot;3&quot;:3}\">3<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Syntax&quot;}\">Syntax<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;The throw keyword is followed by an instance of Exception to be thrown.&quot;}\">The throw keyword is followed by an instance of Exception to be thrown.<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;The throws keyword is followed by class names of Exceptions to be thrown.&quot;}\">\n<div>\n<div>The throws keyword is followed by class names of Exceptions to be thrown.<\/div>\n<\/div>\n<\/td>\n<\/tr>\n<tr>\n<td data-sheets-value=\"{&quot;1&quot;:3,&quot;3&quot;:4}\">4<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Declaration&quot;}\">Declaration<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;throw is used within the method.&quot;}\">throw is used within the method.<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;throws is used with the method signature.&quot;}\">\n<div>\n<div>throws is used with the method signature.<\/div>\n<\/div>\n<\/td>\n<\/tr>\n<tr>\n<td data-sheets-value=\"{&quot;1&quot;:3,&quot;3&quot;:5}\">5<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Internal implementation&quot;}\">Internal implementation<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;We are allowed to throw only one exception at a time i.e. we cannot throw multiple exceptions.&quot;}\">We are allowed to throw only one exception at a time i.e. we cannot throw multiple exceptions.<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;We can declare multiple exceptions using throws keyword that can be thrown by the method. For example, main() throws IOException, SQLException.&quot;}\">\n<div>\n<div>We can declare multiple exceptions using throws keyword that can be thrown by the method. For example, main() throws IOException, SQLException.<\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4><strong>Examples for throw and throws<\/strong><\/h4>\n<p>Check below for examples on throw and throws &#8211;<\/p>\n<ul>\n<li><strong><span data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;throws keyword in java, throw exception in java&quot;}\" data-sheets-userformat=\"{&quot;2&quot;:4542,&quot;4&quot;:{&quot;1&quot;:2,&quot;2&quot;:16777215},&quot;5&quot;:{&quot;1&quot;:[{&quot;1&quot;:2,&quot;2&quot;:0,&quot;5&quot;:{&quot;1&quot;:2,&quot;2&quot;:0}},{&quot;1&quot;:0,&quot;2&quot;:0,&quot;3&quot;:3},{&quot;1&quot;:1,&quot;2&quot;:0,&quot;4&quot;:1}]},&quot;6&quot;:{&quot;1&quot;:[{&quot;1&quot;:2,&quot;2&quot;:0,&quot;5&quot;:{&quot;1&quot;:2,&quot;2&quot;:0}},{&quot;1&quot;:0,&quot;2&quot;:0,&quot;3&quot;:3},{&quot;1&quot;:1,&quot;2&quot;:0,&quot;4&quot;:1}]},&quot;7&quot;:{&quot;1&quot;:[{&quot;1&quot;:2,&quot;2&quot;:0,&quot;5&quot;:{&quot;1&quot;:2,&quot;2&quot;:0}},{&quot;1&quot;:0,&quot;2&quot;:0,&quot;3&quot;:3},{&quot;1&quot;:1,&quot;2&quot;:0,&quot;4&quot;:1}]},&quot;8&quot;:{&quot;1&quot;:[{&quot;1&quot;:2,&quot;2&quot;:0,&quot;5&quot;:{&quot;1&quot;:2,&quot;2&quot;:0}},{&quot;1&quot;:0,&quot;2&quot;:0,&quot;3&quot;:3},{&quot;1&quot;:1,&quot;2&quot;:0,&quot;4&quot;:1}]},&quot;10&quot;:2,&quot;11&quot;:4,&quot;15&quot;:&quot;arial&quot;}\">throw exception in java<\/span><\/strong><\/li>\n<\/ul>\n<p>\/\/ Java program to demonstrate the working<br \/>\n\/\/ of throw keyword in exception handling<\/p>\n<p>public class GFG {<br \/>\npublic static void main(String[] args)<br \/>\n{<br \/>\n\/\/ Use of unchecked Exception<br \/>\ntry {<br \/>\n\/\/ double x=3\/0;<br \/>\nthrow new ArithmeticException();<br \/>\n}<br \/>\ncatch (ArithmeticException e) {<br \/>\ne.printStackTrace();<br \/>\n}<br \/>\n}<br \/>\n}<\/p>\n<p>Output &#8211;<\/p>\n<pre>java.lang.ArithmeticException\r\n    at GFG.main(GFG.java:10)<\/pre>\n<p style=\"text-align: center;\"><a href=\"https:\/\/bit.ly\/3ELmCiA\" target=\"_blank\" rel=\"noopener\"><strong>Learn to code from industry experts! Enroll here<\/strong><\/a><\/p>\n<ul>\n<li><strong>throws keyword in java<\/strong><\/li>\n<\/ul>\n<p>\/\/ Java program to demonstrate the working<br \/>\n\/\/ of throws keyword in exception handling<br \/>\nimport java.io.*;<br \/>\nimport java.util.*;<\/p>\n<p>public class GFG {<\/p>\n<p>public static void writeToFile() throws Exception<br \/>\n{<br \/>\nBufferedWriter bw = new BufferedWriter(<br \/>\nnew FileWriter(&#8220;myFile.txt&#8221;));<br \/>\nbw.write(&#8220;Test&#8221;);<br \/>\nbw.close();<br \/>\n}<\/p>\n<p>public static void main(String[] args) throws Exception<br \/>\n{<br \/>\ntry {<br \/>\nwriteToFile();<br \/>\n}<br \/>\ncatch (Exception e) {<br \/>\ne.printStackTrace();<br \/>\n}<br \/>\n}<br \/>\n}<\/p>\n<p>&nbsp;<\/p>\n<p>Output &#8211;<\/p>\n<pre>java.security.AccessControlException: access denied (\"java.io.FilePermission\" \"myFile.txt\" \"write\")\r\n  at GFG.writeToFile(GFG.java:10)<\/pre>\n<p style=\"text-align: center;\"><a href=\"https:\/\/bit.ly\/3ELmCiA\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-25522670 size-full\" src=\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Rectangle-1.png\" alt=\"Python and Machine Learning Rectangle\" width=\"970\" height=\"250\" srcset=\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Rectangle-1.png 970w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Rectangle-1-300x77.png 300w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Rectangle-1-768x198.png 768w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Rectangle-1-750x193.png 750w\" sizes=\"auto, (max-width: 970px) 100vw, 970px\" \/><\/a><\/p>\n<p>You will be provided with an online platform to prepare for the exam. Entri provides video classes as well on various important topics by the excellent faculties. You can download the app free of cost and join the class. One will get revision modules, monthly tests based on the classes.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Talking about throw and throws, both are the concepts of exception handling. Throw is used to explicitly throw an exception from a method or any block of code. On the other hand, throws are used in the signature of the method to indicate that this method might throw one of the listed type exceptions. What [&hellip;]<\/p>\n","protected":false},"author":81,"featured_media":25524018,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[802,1864,1865,1882,1883],"tags":[],"class_list":["post-25524017","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-articles","category-data-science-ml","category-digital-marketing","category-java-programming","category-react-native"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Difference Between Throw and Throws in Java - Entri Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Difference Between Throw and Throws in Java - Entri Blog\" \/>\n<meta property=\"og:description\" content=\"Talking about throw and throws, both are the concepts of exception handling. Throw is used to explicitly throw an exception from a method or any block of code. On the other hand, throws are used in the signature of the method to indicate that this method might throw one of the listed type exceptions. What [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/\" \/>\n<meta property=\"og:site_name\" content=\"Entri Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/entri.me\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-05-20T16:17:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-11-20T01:16:11+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/05\/generic-blog-thumbnail-22-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"820\" \/>\n\t<meta property=\"og:image:height\" content=\"615\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Shibani Ghosh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@entri_app\" \/>\n<meta name=\"twitter:site\" content=\"@entri_app\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Shibani Ghosh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/\"},\"author\":{\"name\":\"Shibani Ghosh\",\"@id\":\"https:\/\/entri.app\/blog\/#\/schema\/person\/2cfbd0a262fb36f55cb1d95bfc5944b5\"},\"headline\":\"Difference Between Throw and Throws in Java\",\"datePublished\":\"2022-05-20T16:17:50+00:00\",\"dateModified\":\"2022-11-20T01:16:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/\"},\"wordCount\":520,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/entri.app\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/05\/generic-blog-thumbnail-22-1.png\",\"articleSection\":[\"Articles\",\"Data Science and Machine Learning\",\"Digital Marketing\",\"Java Programming\",\"React Native\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/\",\"url\":\"https:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/\",\"name\":\"Difference Between Throw and Throws in Java - Entri Blog\",\"isPartOf\":{\"@id\":\"https:\/\/entri.app\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/05\/generic-blog-thumbnail-22-1.png\",\"datePublished\":\"2022-05-20T16:17:50+00:00\",\"dateModified\":\"2022-11-20T01:16:11+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/#primaryimage\",\"url\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/05\/generic-blog-thumbnail-22-1.png\",\"contentUrl\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/05\/generic-blog-thumbnail-22-1.png\",\"width\":820,\"height\":615},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/entri.app\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Entri Skilling\",\"item\":\"https:\/\/entri.app\/blog\/category\/entri-skilling\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Java Programming\",\"item\":\"https:\/\/entri.app\/blog\/category\/entri-skilling\/java-programming\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Difference Between Throw and Throws in Java\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/entri.app\/blog\/#website\",\"url\":\"https:\/\/entri.app\/blog\/\",\"name\":\"Entri Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/entri.app\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/entri.app\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/entri.app\/blog\/#organization\",\"name\":\"Entri App\",\"url\":\"https:\/\/entri.app\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/entri.app\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2019\/10\/Entri-Logo-1.png\",\"contentUrl\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2019\/10\/Entri-Logo-1.png\",\"width\":989,\"height\":446,\"caption\":\"Entri App\"},\"image\":{\"@id\":\"https:\/\/entri.app\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/entri.me\/\",\"https:\/\/x.com\/entri_app\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/entri.app\/blog\/#\/schema\/person\/2cfbd0a262fb36f55cb1d95bfc5944b5\",\"name\":\"Shibani Ghosh\",\"description\":\"Pouring out my thoughts through words!\",\"url\":\"https:\/\/entri.app\/blog\/author\/shibani\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Difference Between Throw and Throws in Java - Entri Blog","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:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/","og_locale":"en_US","og_type":"article","og_title":"Difference Between Throw and Throws in Java - Entri Blog","og_description":"Talking about throw and throws, both are the concepts of exception handling. Throw is used to explicitly throw an exception from a method or any block of code. On the other hand, throws are used in the signature of the method to indicate that this method might throw one of the listed type exceptions. What [&hellip;]","og_url":"https:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/","og_site_name":"Entri Blog","article_publisher":"https:\/\/www.facebook.com\/entri.me\/","article_published_time":"2022-05-20T16:17:50+00:00","article_modified_time":"2022-11-20T01:16:11+00:00","og_image":[{"width":820,"height":615,"url":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/05\/generic-blog-thumbnail-22-1.png","type":"image\/png"}],"author":"Shibani Ghosh","twitter_card":"summary_large_image","twitter_creator":"@entri_app","twitter_site":"@entri_app","twitter_misc":{"Written by":"Shibani Ghosh","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/#article","isPartOf":{"@id":"https:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/"},"author":{"name":"Shibani Ghosh","@id":"https:\/\/entri.app\/blog\/#\/schema\/person\/2cfbd0a262fb36f55cb1d95bfc5944b5"},"headline":"Difference Between Throw and Throws in Java","datePublished":"2022-05-20T16:17:50+00:00","dateModified":"2022-11-20T01:16:11+00:00","mainEntityOfPage":{"@id":"https:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/"},"wordCount":520,"commentCount":0,"publisher":{"@id":"https:\/\/entri.app\/blog\/#organization"},"image":{"@id":"https:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/#primaryimage"},"thumbnailUrl":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/05\/generic-blog-thumbnail-22-1.png","articleSection":["Articles","Data Science and Machine Learning","Digital Marketing","Java Programming","React Native"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/","url":"https:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/","name":"Difference Between Throw and Throws in Java - Entri Blog","isPartOf":{"@id":"https:\/\/entri.app\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/#primaryimage"},"image":{"@id":"https:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/#primaryimage"},"thumbnailUrl":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/05\/generic-blog-thumbnail-22-1.png","datePublished":"2022-05-20T16:17:50+00:00","dateModified":"2022-11-20T01:16:11+00:00","breadcrumb":{"@id":"https:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/#primaryimage","url":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/05\/generic-blog-thumbnail-22-1.png","contentUrl":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/05\/generic-blog-thumbnail-22-1.png","width":820,"height":615},{"@type":"BreadcrumbList","@id":"https:\/\/entri.app\/blog\/difference-between-throw-and-throws-in-java\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/entri.app\/blog\/"},{"@type":"ListItem","position":2,"name":"Entri Skilling","item":"https:\/\/entri.app\/blog\/category\/entri-skilling\/"},{"@type":"ListItem","position":3,"name":"Java Programming","item":"https:\/\/entri.app\/blog\/category\/entri-skilling\/java-programming\/"},{"@type":"ListItem","position":4,"name":"Difference Between Throw and Throws in Java"}]},{"@type":"WebSite","@id":"https:\/\/entri.app\/blog\/#website","url":"https:\/\/entri.app\/blog\/","name":"Entri Blog","description":"","publisher":{"@id":"https:\/\/entri.app\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/entri.app\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/entri.app\/blog\/#organization","name":"Entri App","url":"https:\/\/entri.app\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/entri.app\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2019\/10\/Entri-Logo-1.png","contentUrl":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2019\/10\/Entri-Logo-1.png","width":989,"height":446,"caption":"Entri App"},"image":{"@id":"https:\/\/entri.app\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/entri.me\/","https:\/\/x.com\/entri_app"]},{"@type":"Person","@id":"https:\/\/entri.app\/blog\/#\/schema\/person\/2cfbd0a262fb36f55cb1d95bfc5944b5","name":"Shibani Ghosh","description":"Pouring out my thoughts through words!","url":"https:\/\/entri.app\/blog\/author\/shibani\/"}]}},"_links":{"self":[{"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/posts\/25524017","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/users\/81"}],"replies":[{"embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/comments?post=25524017"}],"version-history":[{"count":6,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/posts\/25524017\/revisions"}],"predecessor-version":[{"id":25547517,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/posts\/25524017\/revisions\/25547517"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/media\/25524018"}],"wp:attachment":[{"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/media?parent=25524017"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/categories?post=25524017"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/tags?post=25524017"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}