title: Can someone explain to me what a sentinel does in Java? Or how it works?
body: <p>I am trying to understand what sentinel is or how it works with the program. Anyways this is the block of code I am trying to understand. I know it is a sentinel control loop, but I don't know what it does.</p>
  
  <pre><code>private static final int SENTINEL = -999
  </code></pre>
  
  <p>From what I have Googled is that by having a negative integer it indicates the end of a sequence. But how does it do that? Oh, and how do I initialize the sentinel? Is it already initialized?</p>
  
  <pre><code>public static int gameScore(int[] teamBoxScore) { //This is telling me the name of an array
  int output = 0;
  for (int v : teamBoxScore){ //I know that this the values of the array will be stored in the variable "v".
       if (v !=SENTIENL) {// 
           output += v; 
        }
  }
  return output;
  } 
  </code></pre>
  
  <p>Please and Thank you! I am learning how to code with Java</p>