Problem
// Java
public boolean isEmpty(String s) {
return s.length() == 0;
}
# ruby
def empty?(s)
return s.size == 0
end
- The Java method only accepts Strings as arguments and only returns a boolean while…
- The ruby method accepts any Object and could return anything, but in this case will return a boolean if executed without exceptions.