title: Changing a specific value from another class in java
body: <p>Hi I'm trying to make a basic program that will increment a given number until it finds the next prime number, but I'm having problem making it work</p>
  
  <pre><code> PrimeNumber(long eNumb)
   {
     number= eNumb;
   }
  
   public static void incrementNumber()
   {
     this.number = number + 1;
   }
  
  
   boolean foundNext = false;
   PrimeNumber findNext = new PrimeNumber(next);
     while (!foundNext) 
     {
         if (PrimeNumber.isPrime())
         {
          foundNext = true;
         }
         else
         {
          FindNext.incrementNumber();
         }
     }
  </code></pre>
  
  <p>I have the isPrime() method working, but I seem to be entering an infinite loop.
  Sorry if the question is unclear
  EDIT : I entered the wrong code, still wants answer though.</p>