method overloading in java
/*A class having multiple methods with
same name but different parameters
is called Method Overloading*/
public class Names{
static void name(String fname,String lname){
System.out.println("My firstname is "+fname+" and lastname is "+lname);
}
static void name(String fname,String mname,String lname){
System.out.println("My firstname name is "+fname+" and middlename is "+mname+" and lastname is "+lname);
}
public static void main(String[] args){
Names.name("Khubaib","Ahmed");
Names.name("Khubaib","Imtiaz","Ahmed");
}
}