0

Can anyone help me understand the following line of code. I have tried googling the query, but no luck.

public int playerTurn(int token) 
 {
  return token==P1 ? P2 : P1;
 }
LyanR
  • 31
  • 2
  • 3
  • 10
  • Rather duplicate of [What is the Java ?: operator called and what does it do?](http://stackoverflow.com/q/798545/205233) – Filburt Mar 20 '15 at 13:05

1 Answers1

1

Well it is pretty much this

if(token == P1) return P2;
else return P1;
Murat Karagöz
  • 35,401
  • 16
  • 78
  • 107