+ 1
Guys pls explain my that
/ and * and %. in Java.
4 Answers
+ 1
/ is normal division (4/2 = 2)
* is normal multiplication (2*2 = 4)
and % is modulo calculation (3%2 = 1)
What is exactly the issue you wanna talk about?
+ 1
% this is difficult
+ 1
thanks man
+ 1
% means modulo.
When you are calculating with modulo is division by complete numbers like 1, 2, 3, 4,..., n. In other words there are no floating point numbers in this division.
Here are some examples
5 modulo 2 = 2 * 2 + 1 ---> 5%2 = 1
10 modulo 4 = 4 * 2 + 2 ---> 10%2 = 2
1 modulo 2 = 0 + 1 ---> 1%2 = 1
4 modulo 2 = 2 * 2 + 0 ---> 4%2 = 0