Results 1 to 2 of 2
  1. #1
    diegoyj is offline Member
    Join Date
    Jan 2010
    Rep Power

    Default Help with instruction

    I donīt understand this instruction, can someone help me? Which value will have sum?
    player can take two values "0" or "X" which number returns?
    (Im thinking that value will be between -2 and 2 more or less).

    --------> int sum = player.equals("O") ? -2 : 2;

  2. #2
    Lil_Aziz1's Avatar
    Lil_Aziz1 is offline Senior Member
    Join Date
    Dec 2009
    United States
    Rep Power


    Are you asking what
    Java Code:
    int sum = player.equals("O") ? -2 : 2;

    If so, It's basically saying that if player is equal to "O", then set sum equal to negative two. If player does not equal "0", then set sum to positive two. I hope that helps.
    "Experience is what you get when you don't get what you want" (Dan Stanford)
    "Rise and rise again until lambs become lions" (Robin Hood)

Similar Threads

  1. Replies: 0
    Last Post: 01-19-2008, 10:04 AM
  2. First Typed via video instruction
    By ZAXTHEGREAT in forum New To Java
    Replies: 15
    Last Post: 07-23-2007, 05:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts