title: how to do a program that determines if a number is prime or composite
body: <p>Im a beginner at using Java. For some reason, I cant get my program to properly determine if the number I type in is a prime or a composite number. Can someone show me what i'm doing wrong? </p>
  
  <pre><code>public static void main(String[] args) {
      Scanner in = new Scanner(System.in);
      boolean prime = true;
  
      System.out.println("Please enter a number");
      int num1 = in .nextInt();
      int numval = 1;
      for (int i = 2; i &lt; num1; i = i + 1) {
          numval += 1;
          int test = num1;
      }
      if (num1 != 0) {
          System.out.println("This is a prime number");
          prime = false;
  
      }
      if (prime == true) {
          System.out.println("This is not a prime number");
  
      }
  }
  </code></pre>