title: code within if/else statement in do/while loop
body: <p>So heres my code and im running on repl.it and theres an error when I get to the do while loop at in the main code. No loop works inside the main code even when I don't use any of the functions within the loop. So for example I tried a simple while loop with if/else just display random things that were completely unrelated to my actual code but still get the same errors. If anyone knows what I did wrong here, please let me know.</p>
  <pre><code>import java.util.Scanner;
  import java.util.ArrayList;
  import java.util.Arrays;
  
  class Main {
  
    static int[] get_marks(){
      Scanner input = new Scanner(System.in);
  
      ArrayList&lt;Integer&gt; marks = new ArrayList&lt;&gt;();
      final int FLAG = -1;
      int entries = 0;
  
      System.out.println(&quot;Enter your marks. Type -1 when done.&quot;);
  
      while (entries != FLAG){
      entries = input.nextInt();
      
      if (entries &gt;=0 &amp;&amp; entries &lt;= 100){
        marks.add(entries);
      } else if (entries == FLAG) {
        break;
      } else {
        System.out.println(&quot;Invalid entry. Marks must be between 0-100.&quot;);
        }
      }
      input.close();
  
      int[] array = new int[marks.size()];
      for (int i=0; i &lt; marks.size(); i++){
        array[i] = marks.get(i);
      }
      return array;
    }
  
    static int[] frequency(int[] marks_main){
      
      int[] marks_freq = new int[101];
  
      for(int i=0; i&lt;marks_main.length; i++){
        marks_freq[marks_main[i]] += 1;
      }
      return marks_freq;
    }
  
    static int mode(int modeList[], int[] marks_main) {
      int maxValue = 0, maxCount = 0;
  
        for (int i = 0; i &lt; marks_main.length; ++i) {
          int count = 0;
          for (int j = 0; j &lt; marks_main.length; ++j) {
            if (modeList[j] == modeList[i])
             count = count + 1;
           }
  
           if (count &gt; maxCount) {
              maxCount = count;
              maxValue = modeList[i];
           }
        }
        return maxValue;
     }
  
  
    public static void main(String[] args) {
      final String SENTINEL = &quot;Done&quot;, A = &quot;Frequency&quot;, B = &quot;Mode&quot;;
      String user_input; 
      Scanner input = new Scanner(System.in);
      
       int[] marks_main = get_marks();
        System.out.println(Arrays.toString(marks_main));
  
      do {
      
        System.out.println(&quot;Which would you like to use? Type &quot; + A + &quot; for Frequency or &quot; + B + &quot; for Mode&quot;);
        user_input = input.next();
  
        if (user_input.equalsIgnoreCase(A)){
          int[] frequencylist = frequency(marks_main);
          for (int i=0; i&lt;=100; i++){
          System.out.println(i +&quot; : &quot; + frequencylist[i]);
          }
        } else if (user_input.equalsIgnoreCase(B)){
          int modeList[] = marks_main;
          System.out.println(&quot;Mode is &quot;+ mode(modeList,marks_main));
        } else {
          System.out.println(&quot;Invalid Entry&quot;);
        }
  
        System.out.println(&quot;Would you like to run the program again? If not, type &quot; + SENTINEL);
        user_input = input.next();
      } while (!user_input.equalsIgnoreCase(SENTINEL));
      input.close();
  
      System.out.println(&quot;Thanks for using my program!&quot;);
      
      
    }
  }
  </code></pre>