Created
June 29, 2021 03:55
-
-
Save Ram-1234/09f2a5b29cf46e67b44ee5a0629aed50 to your computer and use it in GitHub Desktop.
Method Overloding in java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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