Archive for the 'Java' Category

Method Overloading is possible in JavaScript!

In a full-fledged Object Oriented Programming language such as Java, method overloading is the technique that you could use to create few functions or methods that having the same names but taking different arguments or parameters. Such as follows, the method findUser(), findUser(String), findUser(String, String) in Java.

public class Users
{
   public Collection findUser()
   {
      // the findUser() is a method that returns
      // all users in a java.util.Collection object

   }

   public Collection findUser(String name)
   {
      // the findUser(String) is a method that returns the users matched
      // by the specified name,
      // result returned in a java.util.Collection object

   }

   public Collection findUser(String firstMame, String lastName)
   {
      // the findUser(String,String) is a method that
      // returns the users matched by the specified
      // first and last name, results returned in a java.util.Collection object

   }
}

Continue reading ‘Method Overloading is possible in JavaScript!’