

{"id":7768,"date":"2018-02-10T11:03:48","date_gmt":"2018-02-10T11:03:48","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=7768"},"modified":"2026-05-18T16:26:53","modified_gmt":"2026-05-18T10:56:53","slug":"method-overloading-in-java","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/method-overloading-in-java\/","title":{"rendered":"Method Overloading in Java with Example"},"content":{"rendered":"<p>In <em><strong><a href=\"https:\/\/data-flair.training\/blogs\/polymorphism-in-java\/\" target=\"_blank\" rel=\"noopener\">Java Polymorphism<\/a><\/strong><\/em>, we heard the term Method Overloading, which allows the methods to have a similar name but with a difference in signatures, which is based on the number or type.<em><strong>\u00a0Method Overloading in Java supports compile-time (static) polymorphism.<\/strong><\/em><\/p>\n<p>In this article, we will talk about Method Overloading with its rules and methods. We will discuss each and every concept with an example for a clear understanding. So, let&#8217;s start!<\/p>\n<p><strong>Example of Methods Overloading in Java-<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">class Calculator\r\n{\r\n  int addition(int operand1, int operand2)\r\n  {\r\n    return operand1+operand2;\r\n  }\r\n  int  addition(int operand1, int operand2, int operand3)  \r\n  {\r\n    return operand1+operand2+operand3;\r\n  }\r\n}\r\npublic class CompileTimePolymorphism\r\n{\r\n  public static void main(String args[])\r\n  {\r\n    Calculator obj = new Calculator();\r\n    System.out.println(\"Addition of two operands is \"+obj.addition(10, 20));\r\n    System.out.println(\"Addition of three operands is \"+obj.addition(10, 20, 30));\r\n  }\r\n}\r\n<\/pre>\n<p><strong>Output-<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Compile-time-polymorphism.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-67523\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Compile-time-polymorphism.jpg\" alt=\"Overloading in Java\" width=\"1307\" height=\"741\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Compile-time-polymorphism.jpg 1307w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Compile-time-polymorphism-150x85.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Compile-time-polymorphism-300x170.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Compile-time-polymorphism-768x435.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Compile-time-polymorphism-1024x581.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Compile-time-polymorphism-520x295.jpg 520w\" sizes=\"auto, (max-width: 1307px) 100vw, 1307px\" \/><\/a><\/p>\n<h3>Different Methods of Method Overloading in Java<\/h3>\n<p>Method overloading can be done by 3 <em><strong><a href=\"https:\/\/data-flair.training\/blogs\/java-method\/\" target=\"_blank\" rel=\"noopener\">methods in Java<\/a><\/strong><\/em>:<\/p>\n<h4>By some parameters in the two methods.<\/h4>\n<p>The following example shows how method overloading is done by using a different number of parameters<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">class Calculator\r\n{\r\n  int addition(int operand1, int operand2)\r\n  {\r\n    return operand1+operand2;\r\n  }\r\n  int  addition(int operand1, int operand2, int operand3)  \r\n  {\r\n    return operand1+operand2+operand3;\r\n  }\r\n}\r\npublic class CompileTimePolymorphism\r\n{\r\n  public static void main(String args[])\r\n  {\r\n    Calculator obj = new Calculator();\r\n    System.out.println(\"Addition of two operands is \"+obj.addition(10, 20));\r\n    System.out.println(\"Addition of three operands is \"+obj.addition(10, 20, 30));\r\n  }\r\n}<\/pre>\n<p><strong>Output-<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Compile-time-polymorphism.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-67523\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Compile-time-polymorphism.jpg\" alt=\"Overloading in Java\" width=\"1307\" height=\"741\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Compile-time-polymorphism.jpg 1307w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Compile-time-polymorphism-150x85.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Compile-time-polymorphism-300x170.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Compile-time-polymorphism-768x435.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Compile-time-polymorphism-1024x581.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Compile-time-polymorphism-520x295.jpg 520w\" sizes=\"auto, (max-width: 1307px) 100vw, 1307px\" \/><\/a><\/p>\n<p><em><strong>Recommended Reading &#8211; <a href=\"https:\/\/data-flair.training\/blogs\/java-data-types\/\" target=\"_blank\" rel=\"noopener\">DataTypes in Java with Examples<\/a><\/strong><\/em><\/p>\n<h4>By the data types of the parameters of the methods<\/h4>\n<p>In the following example, <strong>method addition()<\/strong> is overloaded based on the data type of the parameters. We have two methods with the name addition(), one with the parameter of <strong>int type<\/strong> and another <strong><a href=\"https:\/\/docs.oracle.com\/javase\/tutorial\/java\/javaOO\/methods.html\" target=\"_blank\" rel=\"noopener\">method<\/a><\/strong> with the parameter of <strong>string type<\/strong>.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">class Calculator\r\n{\r\n  void addition(int operand1, int operand2)\r\n  {\r\n    System.out.println(operand1+operand2); \r\n  }\r\n  void  addition(String alphabet)  \r\n  {\r\n    System.out.println(alphabet); \r\n  }\r\n}\r\npublic class CompileTimePolymorphism\r\n{\r\n  public static void main(String args[])\r\n  {\r\n    Calculator obj = new Calculator();\r\n    obj.addition(10, 20);\r\n    obj.addition(\"DataFlair\");\r\n  }\r\n}\r\n<\/pre>\n<p><strong>Output-<a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/By-data-types-of-the-parameters-of-methods.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-67757\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/By-data-types-of-the-parameters-of-methods.jpg\" alt=\"By-data-types-of-the-parameters-of-methods\" width=\"1307\" height=\"741\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/By-data-types-of-the-parameters-of-methods.jpg 1307w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/By-data-types-of-the-parameters-of-methods-150x85.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/By-data-types-of-the-parameters-of-methods-300x170.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/By-data-types-of-the-parameters-of-methods-768x435.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/By-data-types-of-the-parameters-of-methods-1024x581.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/By-data-types-of-the-parameters-of-methods-520x295.jpg 520w\" sizes=\"auto, (max-width: 1307px) 100vw, 1307px\" \/><\/a><\/strong><\/p>\n<h4>By order of the parameters of the methods<\/h4>\n<p>Here, both methods have a different sequence of data types in the argument list. The first method has an argument list as (String, char), and the second has (int, String, char). Since the sequence is different, the method can be overloaded without any errors.<\/p>\n<p><em><strong>It&#8217;s the right time to explore <a href=\"https:\/\/data-flair.training\/blogs\/command-line-arguments-in-java-clone-method\/\" target=\"_blank\" rel=\"noopener\">Command Line Arguments in Java<\/a><\/strong><\/em><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">public class MethodOverloadingExample2\r\n {\r\n  void record(String studentName,char grade)\r\n  {\r\n    System.out.println(\"Student name is \"+studentName);\r\n    System.out.println(\"Student grade is \"+grade);\r\n  }\r\n  void record(int id,String studentName,char grade)\r\n  {\r\n    System.out.println(\"Student ID is \"+id);\r\n    System.out.println(\"Student name is \"+studentName);\r\n    System.out.println(\"Student grade is \"+grade);\r\n  }\r\n  public static void main(String[]args)\r\n  {\r\n    MethodOverloadingExample2 Obj=new MethodOverloadingExample2();\r\n    Obj.record(\"Renuka\",'B');\r\n    Obj.record(8, \"Bhumika\", 'A');;\r\n\r\n  }\r\n}<\/pre>\n<p><strong>Output-<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Method-Overloading-Example-2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-67758\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Method-Overloading-Example-2.jpg\" alt=\"Method-Overloading-Example\" width=\"1307\" height=\"741\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Method-Overloading-Example-2.jpg 1307w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Method-Overloading-Example-2-150x85.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Method-Overloading-Example-2-300x170.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Method-Overloading-Example-2-768x435.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Method-Overloading-Example-2-1024x581.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Method-Overloading-Example-2-520x295.jpg 520w\" sizes=\"auto, (max-width: 1307px) 100vw, 1307px\" \/><\/a><\/p>\n<h3>Important Points of Method Overloading in Java<\/h3>\n<h4>Advantage of Method Overloading<\/h4>\n<ul>\n<li>In method overloading, we don\u2019t have to define different names to the methods.<\/li>\n<li>The method is called according to the parameter list. For example, an object calling a method containing 2 parameters will call the method having the same parameter list.<\/li>\n<li>This concept is performed by achieving compile time polymorphism, it means it verifies all the conditions during compile time to safely run the program.<\/li>\n<li>Debugging is simplified as the errors are detected at compile time.<\/li>\n<\/ul>\n<p><em><strong>Have you heard about <a href=\"https:\/\/data-flair.training\/blogs\/method-overriding-in-java\/\" target=\"_blank\" rel=\"noopener\">Method Overriding in Java?<\/a><\/strong><\/em><\/p>\n<h4>Overloading on methods for a different return type in Java<\/h4>\n<p>We cannot perform method overloading for different return types in Java.<\/p>\n<p><strong>Example of method overloading of different types-<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">public class Main\r\n      {\r\n\u00a0\u00a0\u00a0      public int number()\r\n             {\r\n                 return 10;\r\n             }\r\n\/\/ compiler error: number() is already defined\r\n\u00a0\u00a0\u00a0      public char number()\r\n            {\r\n                return 'a';\r\n            }\r\n\u00a0        public static void main(String args[])\r\n\u00a0   }<\/pre>\n<h4>Overloading of the main() method in Java<\/h4>\n<p>Java supports overloading of the main() method.<\/p>\n<p><strong>Example of overloading the main method in Java-<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">public class MetodOverloadingExample1\r\n{\r\n  \/\/ Normal main()\r\n  public static void main(String[] args)\r\n  {\r\n    System.out.println(\"Hello Readers, Welcome to DataFlair\");\r\n  }\r\n  \/\/ Overloaded main methods\r\n  public static void main(String arg1)\r\n  {\r\n    System.out.println(\"Hi, \" + arg1);\r\n    MetodOverloadingExample1.main(\"DataFlair\");\r\n  }\r\n  public static void main(String arg1, String arg2)\r\n  {\r\n    System.out.println(\"Hi, \" + arg1 + \", \" + arg2);\r\n  }\r\n}<\/pre>\n<p><strong>Output-<a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Metod-Overloading-Example1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-67756\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Metod-Overloading-Example1.jpg\" alt=\"Metod-Overloading-Program in Java\" width=\"1307\" height=\"741\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Metod-Overloading-Example1.jpg 1307w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Metod-Overloading-Example1-150x85.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Metod-Overloading-Example1-300x170.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Metod-Overloading-Example1-768x435.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Metod-Overloading-Example1-1024x581.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Metod-Overloading-Example1-520x295.jpg 520w\" sizes=\"auto, (max-width: 1307px) 100vw, 1307px\" \/><\/a><\/strong><\/p>\n<h3>Benefits of Method Overloading in Java<\/h3>\n<p>Method overloading offers several advantages in Java programming:<\/p>\n<p><strong>1. Improved Code Readability:<\/strong> By using the same method name for related operations with distinct parameter sets, you enhance code readability. It becomes clear to developers that these methods perform similar tasks but cater to different data types or numbers of arguments.<\/p>\n<p><strong>2. Increased Code Maintainability:<\/strong> Overloading promotes code maintainability as you can modify an overloaded method without affecting code that relies on other versions of the method with different parameter lists.<\/p>\n<p><strong>3. Enhanced Flexibility:<\/strong> Method overloading allows you to design methods that can handle various data types or argument combinations, making your code more adaptable to different use cases.<\/p>\n<h3>Summary<\/h3>\n<p>Wrapping up, method overloading can be done by 3 methods: by the number of parameters in two methods, the data types of the parameters, and the order of parameters of methods. It is not an easy task; you have to remember some important points, which we discussed above.<\/p>\n<p><em><strong>Don&#8217;t forget to check <a href=\"https:\/\/data-flair.training\/blogs\/constructor-overloading-in-java\/\" target=\"_blank\" rel=\"noopener\">Constructor Overloading in Java<\/a><\/strong><\/em><\/p>\n<p>In order to give suggestions and feedback, please approach our comment section.<span hidden class=\"__iawmlf-post-loop-links\" data-iawmlf-links=\"[{&quot;id&quot;:2035,&quot;href&quot;:&quot;https:\\\/\\\/docs.oracle.com\\\/javase\\\/tutorial\\\/java\\\/javaOO\\\/methods.html&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20251009110857\\\/https:\\\/\\\/docs.oracle.com\\\/javase\\\/tutorial\\\/java\\\/javaOO\\\/methods.html&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2025-12-30 06:01:33&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-07 18:06:16&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-21 07:19:54&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-05 00:20:45&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-08 13:45:01&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-17 10:22:22&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-23 13:26:14&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-27 12:46:51&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-09 23:49:22&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-14 17:04:31&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-27 05:16:19&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-12 16:43:14&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-16 10:43:27&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-24 06:19:14&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-08 10:29:10&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-13 12:45:13&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-28 10:47:58&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-03 06:39:52&quot;,&quot;http_code&quot;:200}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-06-03 06:39:52&quot;,&quot;http_code&quot;:200},&quot;process&quot;:&quot;done&quot;}]\"><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Java Polymorphism, we heard the term Method Overloading, which allows the methods to have a similar name but with a difference in signatures, which is based on the number or type.\u00a0Method Overloading in&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":67749,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[20865,20866,20867],"class_list":["post-7768","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","tag-java-method-overloading","tag-method-overloading-with-exmaple","tag-types-of-method-overloading"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Method Overloading in Java with Example - DataFlair<\/title>\n<meta name=\"description\" content=\"Method Overloading in Java\u00a0allows the methods to have a similar name but with the difference in signatures. Learn more about it with examples\" \/>\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\/method-overloading-in-java\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Method Overloading in Java with Example - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Method Overloading in Java\u00a0allows the methods to have a similar name but with the difference in signatures. Learn more about it with examples\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/method-overloading-in-java\/\" \/>\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-02-10T11:03:48+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-05-18T10:56:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Method-Overloading-in-Java.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"802\" \/>\n\t<meta property=\"og:image:height\" content=\"420\" \/>\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=\"4 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Method Overloading in Java with Example - DataFlair","description":"Method Overloading in Java\u00a0allows the methods to have a similar name but with the difference in signatures. Learn more about it with examples","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\/method-overloading-in-java\/","og_locale":"en_US","og_type":"article","og_title":"Method Overloading in Java with Example - DataFlair","og_description":"Method Overloading in Java\u00a0allows the methods to have a similar name but with the difference in signatures. Learn more about it with examples","og_url":"https:\/\/data-flair.training\/blogs\/method-overloading-in-java\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-02-10T11:03:48+00:00","article_modified_time":"2026-05-18T10:56:53+00:00","og_image":[{"width":802,"height":420,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Method-Overloading-in-Java.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":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/method-overloading-in-java\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/method-overloading-in-java\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823"},"headline":"Method Overloading in Java with Example","datePublished":"2018-02-10T11:03:48+00:00","dateModified":"2026-05-18T10:56:53+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/method-overloading-in-java\/"},"wordCount":575,"commentCount":1,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/method-overloading-in-java\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Method-Overloading-in-Java.jpg","keywords":["Java Method Overloading","Method Overloading with exmaple","Types of method overloading"],"articleSection":["Java Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/method-overloading-in-java\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/method-overloading-in-java\/","url":"https:\/\/data-flair.training\/blogs\/method-overloading-in-java\/","name":"Method Overloading in Java with Example - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/method-overloading-in-java\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/method-overloading-in-java\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Method-Overloading-in-Java.jpg","datePublished":"2018-02-10T11:03:48+00:00","dateModified":"2026-05-18T10:56:53+00:00","description":"Method Overloading in Java\u00a0allows the methods to have a similar name but with the difference in signatures. Learn more about it with examples","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/method-overloading-in-java\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/method-overloading-in-java\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/method-overloading-in-java\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Method-Overloading-in-Java.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Method-Overloading-in-Java.jpg","width":802,"height":420},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/method-overloading-in-java\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Java Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/java\/"},{"@type":"ListItem","position":3,"name":"Method Overloading in Java with Example"}]},{"@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\/7f83c342f5d1632d6f7b4b0b0f447823","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team creates expert-level guides on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our goal is to empower learners with easy-to-understand content. Explore our resources for career growth and practical learning.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/7768","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\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=7768"}],"version-history":[{"count":9,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/7768\/revisions"}],"predecessor-version":[{"id":148352,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/7768\/revisions\/148352"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/67749"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=7768"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=7768"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=7768"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}