CSE 2221 Study Guide - Final Guide: Pariah Dog, Equals Sign, Memory Address

85 views3 pages

Document Summary

Java types are divided into two different categories: the built-in types are called primitive types. Includes boolean, char, int, double: all other types are called reference types (or class types) Reference and object values: a reference variable like s may be considered to have either of two values, the reference value of s in these pictures is the memory address at which the object is stored. Notation: we never care about writing down the reference value of a reference variable as a particular numerical value (though we draw a picture of it: an arrow out of a triangle) O if (cid:455)ou see so(cid:373)ethi(cid:374)g like s = (cid:862)go(cid:863) i(cid:374) a (cid:272)o(cid:374)t(cid:396)a(cid:272)t o(cid:396) a t(cid:396)a(cid:272)i(cid:374)g ta(cid:271)le, it (cid:373)ust (cid:373)ea(cid:374) that the o(cid:271)je(cid:272)t (cid:448)alue of s is the (cid:373)athe(cid:373)ati(cid:272)al (cid:448)alue (cid:862)go(cid:863) The assignment operator = copies the value of the expression on the right-hand side into the variable on the left-hand side. Fo(cid:396) p(cid:396)i(cid:373)iti(cid:448)e t(cid:455)pes, (cid:862)the (cid:448)alue of(cid:863) (cid:272)a(cid:374) (cid:373)ea(cid:374) o(cid:374)l(cid:455) o(cid:374)e thi(cid:374)g.