我不知道这意味着什么:
this.x = x < 0 ? 0 : x;
this.y = y < 0 ? 0 : y;
Run Code Online (Sandbox Code Playgroud)
我找不到这些运营商的意思,任何帮助都将不胜感激!
是.这Terinary(或条件)运算符在java中.if和else条件的简写.
代码this.x = x < 0? 0 : x;相当于
if (x<0) {
this.x = 0
} else{
this.x =x
}
Run Code Online (Sandbox Code Playgroud)