FAQ: Learn Java: Manipulating Variables - Modulo

This community-built FAQ covers the “Modulo” exercise from the lesson “Learn Java: Manipulating Variables”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Learn Java

FAQs on the exercise Modulo

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

im confused because it when i right leftOut it says cannot find symbol to the letter l in leftOut

can you post a pic of that error?

I’ve gone through the Python Modulo section and now while studying Java. What is the use of modulo? Can someone explain this in layman’s terms what the use of it is.

I understand the modules provide examples of Modulo equations, but I’ve yet to grasp what the purpose of it is. Why would you need to know the remainder of division? How does this translate into code and what kind of purpose does it serve in a program?

modulo is the remainder when dividing an integer by an integer (usually).

38 % 5 = 3 because 38 divided by 5 is 7, with 3 left over;
(or 38 ÷ 5 = 7 R 3, therefore 38 % 5 = 3)

12 % 3 = 0 because 12 divided by 3 is 4, with nothing left over;
(or 12 ÷ 3 = 4 R 0, therefore 12 % 3 = 0) … 3 divides 12 evenly.

Yes. But I dont understand the purpose of this value. What is useful about knowing the remainder? What is a real world example of a problem/situation that would require the modulo equation as a solution?