Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

Setting the Field Values#

Sumit Rawal answered on May 23, 2023 Popularity 1/10 Helpfulness 1/10

Contents


More Related Answers

  • C# fieldinfo setvalue in struct
  • set text value in C#
  • Creating and Editing Values #

  • Setting the Field Values#

    0

    Now that we have our object firstPerson, let’s set its field values. To do so, we call the field we wish to set on the object whose field we wish to set.

    Let’s set the name, gender, and age of the object firstPerson.

    123

    firstPerson.name = "Sarah"

    firstPerson.gender = "female"

    firstPerson.age = 25

    To print the field values, we pass object.field to a print method.

    Popularity 1/10 Helpfulness 1/10 Language scala
    Source: Grepper
    Link to this answer
    Share Copy Link
    Contributed on May 23 2023
    Sumit Rawal
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.