title: "boolean"s and "switch" statements (error)
body: <pre><code>import java.math.BigInteger;
  
  public class Classes{
  
  static int i;        //"i" is initialized
  static int x = 200;  //FYI, x is the upper limit for primes to be found (ex, in this case, 0 - 200)
  
  public static void main(String[] args) {
  
  for(i = 0; i &lt; x;){        //"i" is assigned the value of 0 
      BigInteger one = BigInteger.valueOf(i);   // The following lines find the prime(s)
      one = one.nextProbablePrime();          // Order by which primes are found - int &gt; BigInteger &gt; int
      i = one.intValue();     //'i" is re-assigned the a value
      if(i &gt;= x){     
          System.exit(i);     
      }
  
      switch(i){
  
      case i &lt; 100:      // ERROR HERE, "Type mismatch: cannot convert from boolean to int"
          hex();
          break;
  
      case i &gt; 100:      // ERROR HERE, "Type mismatch: cannot convert from boolean to int"
          baseTen();
          break;
      }
  }
  }
  
  
  static void hex(){      //Probably unimportant to solving the problem, but this is used to convert to hex / print
      String bla = Integer.toHexString(i);
      System.out.println(bla);
  }
  
  static void baseTen(){  //Probably unimportant to solving the problem, but this is used print
      System.out.println(i);
  }
  }
  </code></pre>
  
  <p>Hello everybody, I hope you are all doing well. This is my first time on Stack Overflow, so I apologize in advance for any mistakes that I may make. So, let's get to it! I wrote the above code as a practice piece while learning Java and have been using it since to practice and play around with Java. The program was made to find prime numbers and has been working for some time now. Ever since I decided to try out switch statements, I have been having problems. When I go to run the code, the Eclipse IDE says "Type mismatch: cannot convert from boolean to int" and because of this my program refuses to run. I have commented my code with the points at which I cast types and nowhere do I cast "i" into the type "boolean". If you have any idea as to why this problem occurs, please let me know. If you require any additional info, please do ask! Thank You!</p>