title: JAVA - what is the difference between void and boolean methods?
body: <p>I am completely new to JAVA. I am writing a wrapper-library in JAVA to make some functions available in Basic-like language.</p>
  
  <p>I got stock at a certain point when I noted that some code were not executed in the JAVA-library although the compiler did not complain (using Eclipse). I resolved it finally by replacing the code as follows:</p>
  
  <pre><code>public void VideoQuality(int vQuality) //did not work 
  </code></pre>
  
  <p>into </p>
  
  <pre><code>public boolean VideoQuality(int vQuality) //works
  </code></pre>
  
  <p>Here are the complete code-snippets:</p>
  
  <pre><code> public void VideoQuality(int vQuality) //did not work
          {if (vQuality==16) {
              vidQuality=16;
              }
              else if (vQuality==-16)  {
                  vidQuality=-16;
              }
              else if (vQuality==0)  {
                  vidQuality=0;
              }
              else
                  vidQuality=-16;
          vitamioExt.setVideoQuality(vidQuality);
           }  
  
  public boolean VideoQuality(int vQuality) //works
          {if (vQuality==16) {
              vidQuality=16;
              }
              else if (vQuality==-16)  {
                  vidQuality=-16;
              }
              else if (vQuality==0)  {
                  vidQuality=0;
              }
              else
                  vidQuality=-16;
          vitamioExt.setVideoQuality(vidQuality);
          return true;
            }  
  </code></pre>
  
  <p>I think <strong>void</strong> corresponds to a sub in Visual Basic while <strong>boolean</strong> corresponds to a function.</p>
  
  <p>I found it odd however that the following code worked using <strong>void</strong></p>
  
  <pre><code>public void setVolume(float leftVolume,float rightVolume)
        {
            vitamioExt.setVolume(leftVolume, rightVolume);
        }
  </code></pre>
  
  <p>I am surely missing something very obvious but I can't see why the <strong>void</strong>-code would not work while the <strong>boolean</strong>-code worked.</p>
  
  <p>Maybe it depends how I call the code? </p>
  
  <p>Anyone who can shed some lights?</p>
  
  <p>EDIT: to clarify what was not working, I meant that the code:</p>
  
  <pre><code>vitamioExt.setVideoQuality(vidQuality);
  </code></pre>
  
  <p>did not execute in the void-snippet.</p>
  
  <p>EDIT2: vidQuality was declared in a different part of the code. I just posted the snippets since the problems were with those and variables were all functioning.</p>
  
  <p>EDIT3: At the end, I guess I must have called the void-snippet erroneously although the compiler did not compile. In either case, both snippets should execute although of course the void-snippet would be the right one to use since I did not expect a return-value. </p>