title: if in java Vs. if in c++
body: <p>In java we can not use an <code>int</code> with <code>if</code> block like this -  </p>
  
  <pre><code>if(5){ }
  </code></pre>
  
  <p>While compiling it shows the following error - </p>
  
  <pre><code>incompatible types
  found   : int
  required: boolean
          if(5){
             ^
  1 errors
  </code></pre>
  
  <p>I can understand we have to always use <code>boolean</code> here. </p>
  
  <p>But While browsing some c++ code I have found some <code>if</code> block with <code>int</code>. By simplifying them I found something like this -  </p>
  
  <pre><code>   if(0){
          cout&lt;&lt;"Zero: never reachd"&lt;&lt;endl;
      }
  
      if(5){
          cout&lt;&lt;"Non Zero: always reached"&lt;&lt;endl;
      }  
  </code></pre>
  
  <p>And it works fine. I know C++ has <code>bool</code> data type also. So why its compiled without error. Does it mean all non-zero interpreted to <code>true</code> in C++? </p>
  
  <p>Thanks in Advance.</p>