title: Using sentinel-controlled loop
body: <p>I'm having trouble with an exercise asking to have a user prompt a name and echoes that name to the screen until user enters a sentinel value. I understand this is a sentinel-controlled loop but I'm stuck on the fact that I'm dealing with entering a name instead of an integer. I tried to follow a program in my book which only explains how to use a sentinel value with integers but not with String "name". I tried looking up this answer and saw something like name.equals("stop") if it even applies to this. and looked it up on the APIs and still didn't find it helpful. I would like to see how it applies as a whole.<br>
  Note: here is what I have done so far and I want to know how far off I am.</p>
  
  <pre><code>import java.util.*;
  
  public class SentinelControlledLoop {
  
      static Scanner console = new Scanner(System.in);
      static final int SENTINEL = #;
  
      public static void main (String[] args) {
  
          String name;
          System.out.println("Enter a name " + "ending with " + SENTINEL); 
          String name = reader.next();
  
          while (!name.equals(“stop”)) {
              name = reader.next();
          }
  </code></pre>