001-002-018

Variable Assignment and Value Overwriting

Medium

Problem Description

variable Assignment and Value Overwriting

In this problem, you will create a program that declares int and String variables, assigns initial values to them, reassigns new values, and displays the value at each stage to standard output.

Learning Objective: Understand how variable assignment and overwriting works

Overview

Create a program that assigns values to variables, overwrites them, and prints the values at each stage.

Specifications

  1. Declare an int variable score and assign 80
  2. Print the value of score
  3. Reassign 95 to score
  4. Print the new value of score
  5. Assign "B" to a String variable grade and print
  6. Reassign "A" to grade and print

Output Format

score: 80
score: 95
grade: B
grade: A

Ready to Try Running Code?

Log in to access the code editor and execute your solutions for this problem.

Don't have an account?

Sign Up