what are the major differences and similarity in java and ruby?
java, ruby
Solution
What about these:
Similarities
As with Java, in Ruby,...
- Memory is managed for you via a garbage collector.
- Objects are strongly typed.
- There are public, private, and protected methods.
- There are embedded doc tools (Ruby’s is called RDoc). The docs generated by rdoc look very similar to those generated by javadoc.
Differences
Unlike Java, in Ruby,...
- You don’t need to compile your code. You just run it directly.
- All member variables are private. From the outside, you access everything via methods.
- Everything is an object, including numbers like 2 and 3.14159.
- There’s no static type checking.
- Variable names are just labels. They don’t have a type associated with them.
- There are no type declarations. You just assign to new variable names as-needed and they just “spring up” (i.e. a = [1,2,3] rather than int[] a = {1,2,3};).
- There’s no casting. Just call the methods.
- The constructor is always named “initialize” instead of the name of the class.
- You have “mixin’s” instead of interfaces.
- == and equals() are handled differently in Ruby. Use == when you want to test equivalence in Ruby (equals() is Java). Use equal?() when you want to know if two objects are the same (== in Java).
Taken from: To Ruby From Java
Problem
I am java professional now I like to go for ruby.Are there any similarity in both the languages? and what are the major differences? As both are object oriented.