title: i cant understanding negative 2 and positive 2 x=-10 % 4; System.out.println("-10% 4 : "+x); //-2
body: <pre><code>class Example {
  
      public static void main(String args[]) {
          int x;
  
          x = -10 % 4;
          System.out.println("-10%  4 : " + x);   // -2 "explain this"
  
          x = -10 % -4;
          System.out.println("-10% -4 : " + x);   // -2 "explain this"
  
          x = 10 % -4;
          System.out.println("-10% -4 : " + x);   // 2 "explain this"
  
          x = 10 % 4;
          System.out.println("  10% 4 : " + x);   // 2 "explain this"
      }
  }
  </code></pre>
  
  <p>I cant understand how to come (2,-2) plz explain it...</p>
  
  <p>I cant understand negative 2 and positive 2 as the result of</p>
  
  <pre><code>x = -10 % 4;
  System.out.println("-10%  4 : " + x);   // -2
  </code></pre>