CSE 142 Chapter 2: Variables

44 views2 pages
oliveherring648 and 18 others unlocked
CSE 142 Full Course Notes
32
CSE 142 Full Course Notes
Verified Note
32 documents

Document Summary

Pri(cid:373)iti(cid:448)e data (cid:272)a(cid:374) (cid:271)e stored i(cid:374) (cid:272)o(cid:373)puter"s (cid:373)e(cid:373)or(cid:455) i(cid:374) a (cid:448)aria(cid:271)le (a (cid:373)e(cid:373)or(cid:455) lo(cid:272)atio(cid:374) (cid:449)/ a name and a type that stores a value) Co(cid:373)puter"s (cid:373)e(cid:373)or(cid:455) is like e(cid:454)(cid:272)el spreadsheet, (cid:449)he(cid:374) (cid:455)ou (cid:272)reate a (cid:448)aria(cid:271)le i(cid:374) ja(cid:448)a, (cid:455)ou"re asking it to set aside one of the cells for the new variable. I(cid:374)itiall(cid:455) (cid:272)ell (cid:449)ill (cid:271)e e(cid:373)pt(cid:455), (cid:271)ut (cid:455)ou"ll ha(cid:448)e optio(cid:374) to store a (cid:448)alue i(cid:374) the (cid:272)ell, a(cid:374)d (cid:455)ou (cid:272)a(cid:374) change that value later if needed. Java req you to tell it exactly what kind of data you are storing. If you intend to store a real value, then you need to tell java you intend to use a double: normal rules of identifiers apply. Standard convention in java is to start variable names w/ lowercase letter and capitalize any subsequent words. Before variables can be used, they must be declared.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents