Posted By:
Joe_Pollard
Posted On:
Tuesday, August 14, 2001 11:27 PM
That should work as long as you are using ints. If you aren't using ints, then modulus really doesn't make since as an operator.
public class tmp {
public static void main(String [] s) { new tmp(); }
public tmp() {
int variable = 50;
int expression = 4;
int result = variable % expression;
System.out.println(result);
}
}
Take a look at the specification of this operator at http://java.sun.com/docs/books/jls/first_edition/html/15.doc.html#24956 . If you still have questions, please post your error message and code and we'll help you fix it.... Hope that helps!
-Joe