Java

For the purposes of this discussion, Sun Microsystems’ Java is a moderately complex, object-oriented language similar to C. Java has both strong and static typing. In one way, Java is more object oriented than Ruby is: A programmer coding in Java must use an object-oriented paradigm for his own programs. On the other hand, Java is less object oriented than Ruby is in the way that it implements its own built-in features. For example, to get the absolute value of the integer 100 in Java, you would do this:

Math.abs(100)

This means that the programmer wants to use a method called abs, which is associated with Math, to perform that method’s action on the integer 100. The equivalent operation in Ruby would be performed as follows:

100.abs

Using Ruby’s ...

Get Ruby by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.