Skip to content

Instantly share code, notes, and snippets.

@Ram-1234
Created June 29, 2021 03:55
Show Gist options
  • Save Ram-1234/09f2a5b29cf46e67b44ee5a0629aed50 to your computer and use it in GitHub Desktop.
Save Ram-1234/09f2a5b29cf46e67b44ee5a0629aed50 to your computer and use it in GitHub Desktop.
Method Overloding in java
//If a class has multiple methods having same name but different in parameters, it is known as Method Overloading.
/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
static int add(int a,int b){return a+b;}
static int add(int a,int b,int c){return a+b+c;}
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
System.out.println(Ideone.add(11,11));
System.out.println(Ideone.add(11,11,11));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment