I have no idea what does this mean:
this.x = x < 0 ? 0 : x;
this.y = y < 0 ? 0 : y;
I could not find the meaning of these operators, any help will be greatly appreciated!
Yes. That Terinary (or Conditional) Operator in java. A short hand for if and else condition.
The code this.x = x < 0? 0 : x;
equivalent to
if (x<0) {
this.x = 0
} else{
this.x =x
}
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加