title: How to write a Java program that generates three random integers between 0 and 50, calculates the average?
body: <p>How to write a Java program that generates three random integers between 0 and 50, calculates the average?</p>
  
  <p>My code is like this:</p>
  
  <blockquote>
    <p></p>
  </blockquote>
  
  <pre><code>import java.util.Random;
  
  public class RandomAverage {
  
  
  public static void main(String[] args) 
  {
  
  
  int num1,num2,num3;
  int sum,average;
  Random random = new Random();
  num1 = random.nextInt(51);
  num2 = random.nextInt(51);
  num3 = random.nextInt(51);
  sum = num1+ num2+ num3;
  average = sum/3;
  System.out.print("The sum of them is :" + sum);
  System.out.print("The average of them is :" + average);
  
  
  
  }
  
  }
  </code></pre>
  
  <p>but the output said:</p>
  
  <pre><code>Error: Could not find or load main class stringchecker.StringChecker
  Java Result: 1
  BUILD SUCCESSFUL (total time: 0 seconds)
  </code></pre>
  
  <p>what's wrong with that?</p>