3 Java Lesson #2 Homework.pdf - 2/22/2021...

This preview shows page 1 - 2 out of 2 pages.

2/22/20211/2College1.com - Programming and AlgorithmsHomework #2 - Variables: Types, Names and Values (10 points)variable adj: Likely to change or vary; subject to variation; changeable.I have always thought of a variable as a location in computer memory where I can store a value.A variable has aname(or identifier), memory is allocated for itA variable has avaluestored in its memoryA variable has atype, 'what' kind of information is stored in memory.Writeoneline of Java code todeclareeach variable ( ; required ):Variable name is grade, type is char, value is hchar grade = 'h';(1)correctVariable name is gpa2, type is double, value is 4.51double gpa2 = 4.51;(2)correctVariable name is the_name, type is String, value is LisaString the_name = "Lisa";(3)correctA variable can be 'changed' by the standard arithmetic operators + (addition), - (subtraction), * (multiply) and /

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 2 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Spring
Professor
N/A
Tags
variable adj

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture