title: Can't seem to understand the error after a few days
body: <p>Hello So i'm doing the following for practice:</p>
  
  <ul>
  <li><strong>wordcount:</strong> This method should accept a reference to a String object as an argument and return the number of words contained in the object</li>
  <li><strong>arrayToString:</strong> This method adepts a char array as an argument and converts it to a String object. The method should return a reference to the String object.</li>
  <li><strong>Mostfrequent:</strong> This method accepts a reference to a String object as an argument and returns the character that occurs the most frequently in the object.</li>
  <li><p><strong>ReplacaSubstring:</strong> This method accepts three references to String objects as arguments. Lett's call them stringl, string2, and string3. It searches stringl for all occurrences of string2. When it finds an occurrence of string2, it replaces it with string3, For example, suppose the three arguments have the following values:</p>
  
  <ul>
  <li>String1: "the dog jumped over the fence"</li>
  <li>String2: "the"</li>
  <li>String3: "that"</li>
  </ul>
  
  <p>With these three arguments, the method would return a reference to a String object with the value "that dog jumped over that fence".</p></li>
  </ul>
  
  <p>My following code (Main):</p>
  
  <pre><code>import java.util.Scanner;
  
  public class Demo {
      public static void main(String[] args) {
          String string1 = "the dog jumped over the fence";
          String string2 = "the";
          String string3 = "that";
          char[] charArray = { 'a', 'b', 'c', 'd', 'e', 'f', 'g',
                              'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
                              'q', 'r', 's', 't', 'u', 'v','w', 'x','y', 'z'};
  
          // wordCount method
          int numberOfWords = wordCount(string1);
          System.out.println("Count the number of words: " + string1);
          System.out.println("Number of words given string: " + numberOfWords);
  
          // arrayToString method
          String character = arrayToString(charArray);
          System.out.print("\nGiven characters in the array:");
  
          for(int i = 0; i &lt; charArray.length; i++)
  
          System.out.print(charArray[i] + " ");
          System.out.print("\nString from given character array: " + character);
  
          // mostFrequent method
          char mostOccurrence = mostFrequent(string1);
          System.out.println("\nGiven string to get the most occured characters: " + string1);
          System.out.println("The most occured character in given string: " + mostOccurrence);
  
          //replaceSustring method
          String string = replaceSubstring(string1, string2, string3);
          System.out.println("\nGiven string to modify: " + string1);
          System.out.println("Replace for: " +string2);
          System.out.println("After replacing, the new string: " + string);
      }
  }
  </code></pre>
  
  <p>With the following error for this class:</p>
  
  <pre><code>C:\Users\carlosm\Desktop\New folder\MiscellaneousString.java:1: error: class MiscellaneousStringClass is public, should be declared in a file named MiscellaneousStringClass.java
  public class MiscellaneousStringClass {
         ^
  1 error
  </code></pre>
  
  <p>And regular class file:</p>
  
  <pre><code>public class MiscellaneousStringClass {
  
      int numberOfWords;
      /* method should accept a reference to a string object
       * as an argument and return the number of words contain
       * in the object
       */
  
       private static int wordCount(String string1) {
          int number = 0;
  
          for(int i = 0; i &lt; string1.length(); i++) {
              char ch = string1.charAt(i);
  
              if(Character.isWhitespace(ch)) {
                  number = number + 1;
              }
          }
  
          return number + 1;
       }
  
       /* method should accept a char array as an argument and convert i to a string object.
        * The method should return to the string object.
        */
        private static String arrayToString(char[] charArray) {
            return String.valueOf(charArray);
        }
  
        /* method accepts a reference to a string object as an argument
         * and returns the character that occurs the most frequently
         * in the object.
         */
  
         private static char mostFrequent(String string1) {
             char mostOccurrence = ' ';
             int most = 0;
             int j;
             for(int i = 0; i &lt; string1.length(); i++) {
                 int count = 0;
                 char ch = string1.charAt(i);
  
                 for(j = 0; j &lt; string1.length(); j++) {
                     if(ch == string1.charAt(j))count = count + 1;
                 }
  
                 if(count &gt;= most) {
                     most = count;
                     mostOccurrence = ch;
                  }
              }
  
              return mostOccurrence;
          }
  
      /* method accepts three references to string object as arguments.
       * Call them string1, string2, and string3; when it finds an occurrence
       * of string2, it replaces it with string 3.
       */
  
       private static String replaceSubstring(String string1, String string2, String string3) {
          return string1.replaceAll(string2, string3);
      }
  }
  </code></pre>
  
  <p>And following error for this class:</p>
  
  <pre><code>C:\Users\carlosm\Desktop\New folder\Demo.java:13: error: cannot find symbol
          int numberOfWords = wordCount(string1);
                              ^
    symbol:   method wordCount(String)
    location: class Demo
  C:\Users\carlosm\Desktop\New folder\Demo.java:18: error: cannot find symbol
          String character = arrayToString(charArray);
                             ^
    symbol:   method arrayToString(char[])
    location: class Demo
  C:\Users\carlosm\Desktop\New folder\Demo.java:27: error: cannot find symbol
          char mostOccurrence = mostFrequent(string1);
                                ^
    symbol:   method mostFrequent(String)
    location: class Demo
  C:\Users\carlosm\Desktop\New folder\Demo.java:32: error: cannot find symbol
          String string = replaceSubstring(string1, string2, string3);
                          ^
    symbol:   method replaceSubstring(String,String,String)
    location: class Demo
  4 errors
  </code></pre>
  
  <p>Any help will do.</p>