BIRT 3.7
Written by: Michael Williams
Featured Refcardz: Top Refcardz:
  1. Scrum
  2. Apache Maven 2
  3. Essential MySQL
  4. Node.js
  5. Groovy
  1. jQuery Selectors
  2. Ajax
  3. Java
  4. Spring Config.
  5. Java Concurrency

Link Details

Link 707957 thumbnail
User 225256 avatar

By mswatcher
via weblogs.java.net
Published: Dec 08 2011 / 08:18

Java has no operator overloading. I always thought that was a shame. For example, BigDecimal would be a lot more popular if you could write a * b instead of a.multiply(b). Why doesn't Java have operator overloading? Well,  C++ has it, and people kept saying that it makes code hard to read. Actually, in C++, you can have a library class vector and write v[i], thanks to operator overloading. In Java, we have unsightly v.get(i) and v.set(i, newValue). Easier to read? I think not.
  • 4
  • 1
  • 673
  • 371

Comments

Add your comment
User 352719 avatar

Jonathan Fisher replied ago:

2 votes Vote down Vote up Reply

Operating overloading is all around a horrible idea. I'm glad it's difficult for Java and I hope never ever to see it.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (4)



Voters Against This Link (0)