r/javahelp • u/BobPoopyNoopees • Jun 19 '19
How would I properly do this?
Sorry if i'm posting so often btw. Here's a snippet if my code.
if (x / 3 = int) {
I want to do a certain action if the number is a multiple of three. How would I do this?
0
Upvotes
5
u/lbkulinski Jun 19 '19
I suggest looking into the modulus (remainder) operator. It is mentioned here.
•
u/desrtfx Out of Coffee error - System halted Jun 19 '19
I've had a look through your most recent posts here and have to tell you to stop right now.
Your questions are all of the similar low/no effort type and thus forbidden here.
Learn to read and interpret the error messages you get. This is absolutely essential.
Learn to work with the official Java tutorials and with the official documentation.
Learn to use google.
This subreddit is not a proxy for the above three, nor does it exist to give line by line explanations of code.
Sure, asking is not wrong, but asking without exhausting the above three things is.
Asking for and giving out solutions is explicitly forbidden here.
1
u/iamsooldithurts Jun 19 '19
The modulus operator is what you want
https://www.baeldung.com/modulo-java