Skip to main content

Posts

Showing posts with the label Method Overloading

Method Overloading in Java | Type Promotion | Ambiguous Problem | Var args in Method Overloading

  What is Method Overloading? Method Overloading means one class have same methods name but have different parameters or arguments. In simple term, when any class contains same method name in class but with different parameters it is called Method Overloading in Java. In another simple term, using Method overloading in java we can create multiple same name methods in one class. In Method Overloading, method resolution always takes care by compiler based on method parameters. So it is also called Compile Time Polymorphism or Static Polymorphism or Early Binding. Learn more about Polymorphism and OOPs concept : Object Oriented Programming (OOP) concept in Java with Examples   In Method Overloading, method signature must be different. Means if we write same method signature in same class it gives compile time error. What is Method Signature? In java, method signature contains only method name followed by argument types. following code is called method signature in java.  No...