
Java
cout << "Hello World" << endl;
Even though it appears that these are just "shift operations", they take on the special meaning of outputting (for cout) and inputting (for cin) without resorting to a more cumbersome:
cout.print("Hello World\n");
This short example doesn't illustrate the savings that this syntax allows; a string of 20 variables would very nicely outline how the shift operators streamline cout.
Unfortunately, this usage is considered controversial, because it allows developers to use odd syntax. Consider the following:
Vehicle car = new Vehicle();
Velocity speed = new Velocity(15);
car += speed;
This is legal syntax with operator overloading. While it might make sense to some developers, others less familiar with a library might need to dig down into the code to make sure that the effect is what the developer intended. This can slow down development and debugging. It is this controversial usage that has prompted future languages, such as Java, to specifically exclude such functionality in an attempt to keep code as legible as possible.
Copyright © 2026 eLLeNow.com All Rights Reserved.