Kazley82271 Kazley82271
  • 04-09-2020
  • Computers and Technology
contestada

Consider the following code segment. int j = 10; int k = 8; j += 2; k += j; System.out.print(j); System.out.print(" "); System.out.println(k); What is printed when the code segment

Respuesta :

codiepienagoya codiepienagoya
  • 04-09-2020

Answer:

Following are the output of the given code:

Output:

12 20

Explanation:

Description of the code:

  • In the java program code, two integer variable "j and k" is defined, that stores a value, that is "10 and 8", in its respective variable.
  • After storing the value it uses the "j and k" variable, in this, it increments the value of j with 2, and in the k variable, it adds the value of j and stores the value in k.
  • After incrementing the value, the print method is used that prints the value of "j and k", i.e, "12 and 20".
Answer Link

Otras preguntas

Waves that move matter back and forth are called                 a.transverse waves  b.longitudinal wave     c. Medium wave
A man walks 15 blocks to work every morning at a rate of 2 miles per hour. If there are 20 blocks in a mile, how long does it take him to walk to work?
Robert has 12 coins totaling $1.45. None of his coins is larger than a quarter. Which of the following cannot be the number of quarters he has?
Substitution method X = 4 2x - 3y = -19
If the edges of a cube add up to 4 feet in length, what is the volume of the cube?
A wave with a large amplitude has a lot of             a.vibration  b.speed   c.energy
How do you factor k^2-k-56
How did the people of the French Revolution overthrow the government?
How did the people of the French Revolution overthrow the government?
Substitution method X = 4 2x - 3y = -19