Question

(Java expressions) What do the following statements do? i++; i += 2; i /= 10;

(Java expressions) What do the following statements do?

i++;

i += 2;

i /= 10;

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The following ststements perform the following action:-

In all the cases we assume we have created a variable i in the program.

1. When we write i++, we ask the system to add 1 to the value of i (variable) in a given loop.

2. i += 2

When we write i+=2, what we mean is i = i + 2.

3. i /= 10

When we write i/= 10, what we mean is i = i / 10

Add a comment
Know the answer?
Add Answer to:
(Java expressions) What do the following statements do? i++; i += 2; i /= 10;
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Select all statements or expressions that would allow a Java program to display the length of...

    Select all statements or expressions that would allow a Java program to display the length of array Infant_Age, as defined as follows: int Infant_Age[] = {1, 2, 3, 4} (Check all that apply.) a. System.out.print (Infant_Age.length) b. len = Infant_Age.length; System.out.print(len); c. for (int i=0; i<4; i++) {System.out.print (i)} d. System.out.print (Infant_Age[4]) e. System.out.print (length.Infant_Age)

  • Select all statements or expressions that would allow a Java program to display the length of...

    Select all statements or expressions that would allow a Java program to display the length of array Infant_Age, as defined as follows: int Infant_Age[] = {1, 2, 3, 4} (Check all that apply.) a. System.out.print (Infant_Age.length) b. len = Infant_Age.length; System.out.print(len); c. for (int i=0; i<4; i++) {System.out.print (i)} d. System.out.print (Infant_Age[4]) e. System.out.print (length.Infant_Age)

  • 1: What do the following statements do? a) if (total != stock + warehouse) inventoryError =...

    1: What do the following statements do? a) if (total != stock + warehouse) inventoryError = true; if (found || !done) System.out.println("Ok"); b) count1 = 1; while (count1<=10) { count2 = 1; while (count2 < 20) { System.out.println("here"); count2++; } count1++; } Part 2: SEND AS A TEXT FILE USING JAVA ECLIPSE AND MAKE SURE IT IS SENT IN THE EXACT FORM AS I WILL BE COPYING AND PASTING IT INTO JAVA ECLIPSE, MAKE SURE TO STATE WHAT IS BEING...

  • JAVA PROGRAMMING I want to make sure I have learned the compareto statements correct and other...

    JAVA PROGRAMMING I want to make sure I have learned the compareto statements correct and other things. This was on my lecture slide today and I don't understand the compare to regarding how they get values for the strings. Please answer the following. Suppose that s1, s2, and s3 are three strings, given as follows String s1 = "Welcome to Java". String s2 = "Programming is fun". String s3- "Welcome to Java" hat are the results of the following expressions?...

  • Language: Java I am looking to create a .java class that will do the following for...

    Language: Java I am looking to create a .java class that will do the following for me: For example I search "sword" and if a line contains the text sword (in the following fomat), Then it changes the line "equipment-slot": RING, to equipment-slot": WEAPON, "id": 6605, "name": "White sword", "examine": "It's a White sword.", "equipment-slot": RING, "stackable": false,

  • For the circuit shown below do the following: 1. Find expressions for vc(t) and i(t) for...

    For the circuit shown below do the following: 1. Find expressions for vc(t) and i(t) for t 2 0. а. Find an expression for the power to the resistor, pR(t) b. Integrate the power to the resistor from t = 0 to co. С. d. Show that the total energy to the resistor is equal to the energy stored in the capacitor at t 0 Determine the time at which Vc(t) 25 V? е. t 0 i(t) vc(t) 2 HF...

  • Complete the following java program in which infix expressions should be converted to postfix expressions /**...

    Complete the following java program in which infix expressions should be converted to postfix expressions /** * An algebraic expression class that has operations such as conversion from infix * expression to postfix expression, * and evaluation of a postfix expression */ public class Expression { /** * The infix of this expression */ private String infix; /** * Constructs an expression using an infix. */ public Expression(String infix){ this.infix = infix; } /** * Converts an infix expression into...

  • 3. Use EBNF to describe the syntax of Java while statements, no need to further define...

    3. Use EBNF to describe the syntax of Java while statements, no need to further define other statements or Boolean expressions.

  • Question Which of the following are propositional expressions? 1. The computeris a tablet 2. A tablet...

    Question Which of the following are propositional expressions? 1. The computeris a tablet 2. A tablet computer is the best computer 3. The sky is blue 4. If the sky is blue then unicorns do not have a forehead horn 5. It is not the case the building has ten floors 6. x + 5 = 9 7. 6 + 5 = 9 8. Shelly seems like a good person 9. Is Bob tall? 10. There are ten single digit...

  • Question 2: Formalization of Logical Expressions Translate the following statements into predicate calculus. If you name...

    Question 2: Formalization of Logical Expressions Translate the following statements into predicate calculus. If you name your predicates intuitively, you do not have to define them separately. a) Jenna watches only funny movies. b) Ernie knows all of Bert’s friends. c) Petra and Paula do not take any classes together. e) Carl beats up all professors that fail him. f) There is at most one computer scientist who can dance. g) There are no scientists who are neither crazy nor...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT