title: Give a random age number between 0-9 Java
body: <p>So I'm currently a beginner programmer trying to slove some basic programming tasks. But I dont understand why My code is wrong. In eclipse everyting works. It's a coding problem from codewars.com</p>
  <p>Introduction:
  You ask a small girl,&quot;How old are you?&quot; She always says, &quot;x years old&quot;, where x is a random number between 0 and 9.</p>
  <p>Write a program that returns the girl's age (0-9) as an integer.</p>
  <p>Assume the test input string is always a valid string. For example, the test input may be &quot;1 year old&quot; or &quot;5 years old&quot;. The first character in the string is always a number.</p>
  <pre><code>package headfirstjava;
  import java.util.Random;
  
  
  
  public class do_something5 {
  
      public static void main(String[] args) {
          // TODO Auto-generated method stub
          {
          int min =1;
          int max =9;
          int age1 = (int)Math.round(Math.random() * (max - min)+ min);
          int age2 = (int)Math.round(Math.random() * (max - min + 1)+ min);
          System.out.println(&quot;I'm &quot;+ age1+ &quot; Old&quot;);
      }
      
      }
  
  }
  </code></pre>