Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does --> mean in Java? [duplicate]

for (int i = 99; i --> 0;) {     System.out.println(i); } 

Above code works, and has the exactly same result of

for (int i = 99; i >= 0; i--) {     System.out.println(i); } 

What does the syntax "-->" originally mean in Java? Since almost reachable search engines disallow special characters, I cannot seem to find the answer.

like image 733
TigerHix Avatar asked Apr 03 '15 09:04

TigerHix


People also ask

What does --> mean in Java?

--> is not a new operator. It is just a conjunction of the operators -- and > . You first compare, and then decrement the variable. That is, i --> 0. becomes effectively i > 0; //Compare i--; //and decrement.

What is the difference between >>> and >> in Java?

>> is arithmetic shift right, >>> is logical shift right. In an arithmetic shift, the sign bit is extended to preserve the signedness of the number. For example: -2 represented in 8 bits would be 11111110 (because the most significant bit has negative weight).

What is duplicate object in Java?

lang. String objects a and b are duplicates when a != b && a. equals(b) . In other words, there are two (or more) separate strings with the same contents in the JVM memory.


1 Answers

--> is not a new operator.

It is just a conjunction of the operators -- and >.

You first compare, and then decrement the variable.

That is,

i --> 0 

becomes effectively

i > 0; //Compare i--; //and decrement 
like image 134
shauryachats Avatar answered Sep 22 '22 22:09

shauryachats