title: If within an if statement Java
body: <p>I'm having some trouble inserting an if statement within an if statement. When the first 'if condition' is met, it still utilises the 'else' statement. Is there a way I can rewrite my code so that the 'else' statement is not being utilised. I thought that if the first 'if condition' was met then it would not check the else statement. I know I could use a switch statement, but I wanted to compare and contrast the uses of switch and if statement to gain a better understanding of Java. Below is my code. Thanks </p>
  
  <pre><code>    int age = 0;
  
      if (age == 0)
      {
          {System.out.println("You can crawl");}
          if (age == 1) {
              System.out.println("You can talk");
          } else {
              System.out.println("You can walk");
          }
      }
  </code></pre>
  
  <p>console:
  You can crawl
  You can walk</p>