Hello Rubies,
Ruby is an object oriented programing language. we don't declare the data type of variables or methods - everything is treated as object. Ruby supports feature called 'duck typing'. Duck typing more concern about what's the behavior of method and what methods can be called on it.
For eg.
We create the simple method to do the multiplication of two arguments. As in ruby we didn't define the data type. So it return the output of method in requested method format.
def calculate(a, b)
return a * b
end
case a.
Pass integer as argument
calculate(2, 3) => 6
case b.
Pass string as argument
calculate('Ruby on ', 'Rails') => Ruby on Rails
So as per argument type it return back the result in requested format. So this is the concept of duck typing.
If we have to implement same functionality using java than it requires to define methods as per requested type. so when we invoke the method than it first match argument type than return the appropriate result.
So now you know how cool is ruby than java ;)