CSE 142 Lecture 3: 3 Expressions
CSE 142 verified notes
3/30View all
Document Summary
Interactions (cid:862)i(cid:374)tera(cid:272)tio(cid:374)s(cid:863) i(cid:374) jgrasp allo(cid:449) (cid:455)ou to tr(cid:455) out differe(cid:374)t state(cid:373)e(cid:374)ts and expressions - code that. A statement, as we have learnt is something like the system. out. println (cid:272)o(cid:373)(cid:373)a(cid:374)d. o(cid:374) the other ha(cid:374)d, a(cid:374) e(cid:454)pressio(cid:374) is so(cid:373)ethi(cid:374)g like arith(cid:373)eti(cid:272) e(cid:454)pressio(cid:374)s, (cid:862)(cid:1005)+(cid:1005)(cid:863) (cid:894)(cid:449)hi(cid:272)h (cid:449)ill output a (cid:862)(cid:1006)(cid:863)(cid:895). Ja(cid:448)a thi(cid:374)ks a(cid:374) i(cid:374)teger a(cid:374)d real (cid:374)u(cid:373)(cid:271)er is differe(cid:374)t. for e(cid:454)a(cid:373)ple, the i(cid:374)teger (cid:862)3(cid:863) has an equivalent value as the real (cid:374)u(cid:373)(cid:271)er (cid:862)(cid:1007). (cid:1004)(cid:863) (cid:271)ut ja(cid:448)a thi(cid:374)ks the(cid:455) are (cid:1006) (cid:272)o(cid:373)pletel(cid:455) differe(cid:374)t values. Further(cid:373)ore, (cid:449)he(cid:374) (cid:449)e (cid:373)ultipl(cid:455) or di(cid:448)ide usi(cid:374)g ju t i(cid:374)tegers, it (cid:449)ill (cid:862)tru(cid:374)(cid:272)ate(cid:863) the (cid:448)alue. If you mix integers and real numbers, you will get real numbers as the output as it prioritizes the real number. The order of operations in java works like pemdas as in math classes. Precedence, however, is slightly different which will be discussed later. They are essentially the same as in math.