- Write a Java statement to accomplish each of thefollowing tasks:
- Declare variables sum and x to be of type int.
- Assign 1 to variable x.
- Assign 0 to variable sum.
- Add variable x to sum, and assign the result to variablesum.
- Print “The sum is: “, followed by the value of variablesum.
- Combine the statements that you wrote into a Javaapplication that calculates and prints the sum of integer from 1 to10. Use the while loop through the calculation and incrementstatements. The loop should terminate when the value of x become11.
Answer to Write a Java statement to accomplish each of the following tasks: Declare variables sum and x to be of type int. Assign…