title: Initializing Variables in Java
body: <p>I am trying to run the following code:</p>
  <pre><code>import textio.TextIO;
  
  public class Main{
      public static void main(String[] args){
          String str; // Line of text entered by the user.
          System.out.println(&quot;Please type in a line of text.&quot;);
          str = TextIO.getln();
          int vcount; 
          int ccount; 
          char y[] = str.toCharArray();
          int size = y.length;
          
          int i = 0;
          while(i != size)
          {
              if(y[i]&gt;='A' &amp;&amp; y[i]&lt;='Z')
              {
                  if(y[i]=='A'||y[i]=='E'||y[i]=='I'||y[i]=='O'||y[i]=='U')
                  {
                      ++vcount;
                  }
                  else
                  {
                      ++ccount;
                  }
                  ++i;
              }
              int ratio = vcount/ccount;
              System.out.println(&quot;The vowel/consonant ratio of arithmetic is&quot; + ratio);
          }
      }
  }
  </code></pre>
  <p>This code is not compiling because the compiler says the variables <code>vcount</code> and <code>ccount</code> are not initialized. I think I have already initialized both these variables at the beginning of the code. Where am I going wrong?</p>