CSC 220 Lecture 1: Lecture 1 Tuesday Aug 20 Review

33 views3 pages
Verified Note

Document Summary

Java follows common order of operation rules: unary op have highest priority, then *,/,, then +,, then = int a = 3; int b = 4; int c = 2; Look up operator precedence for whole list: above will print 11 int i = 3; int j = i++ +4; "count = " + 4 evaluates to "count = 4" (concatenation: integer converts it to an. Integer with new int(4) then converted to strong with integer. tostring() then two strings are concatenated: mixing types, conversions are done on one operator at a time in the order the operators are evaluated. 3 / 2 * 3. 0 + 8 / 3: above will evaluate to 5. 0 (note that 8/3 is 2 because both are ints) 2. 0 * 4/5+6/4. 0: above evaluates to 3. 1, string concatenation has the same precedence as +- and is evaluated left to right. 1 + "x" + 4: evaluates to "1x4"

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