Search the courses, subjects, tracks, games and features, or jump straight to a page.
3 cards from this section. Quick, good the night before a test.
What does the '=' operator do in Java?
Think about how you store data in a box.
What is the shorthand operator for adding a number and assigning it?
It's like telling the variable to get bigger by a certain amount.
What does the += operator do?
Think of how you would add and keep the result.
True or False: The assignment operator '=' can only be used once in a program.
Can you think of a scenario where you'd need to assign multiple values?
You have a variable score that starts at 50. Write a piece of code that increments the score by 10 three times and then prints it.
Think about how you’d repeat the addition of the score.
Consider a scenario where balance is initially 500. If you spend $150 and then receive $75, write the code that reflects these transactions using assignment operators.
Remember to first take away the spending before adding what you have received.
5 more questions in this section. Enroll free to practise them all.
Enroll free