0914 - Introduction to Programming Languages and Techniques...

Info iconThis preview shows pages 1–13. Sign up to view the full content.

View Full Document Right Arrow Icon
Introduction to Programming Languages and Techniques Java for the Experienced, II Expressions and arrays
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
9/11/09 CIS 120, Fall 2009 Exam Dates Notify me of conflicts before the exams! 2 (not 9/28)
Background image of page 2
Course BB 9/11/09 CIS 120, Fall 2009 3 You should be checking it at least once a day. ..
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Office Hours 9/11/09 CIS 120, Fall 2009 4 location may change
Background image of page 4
MORE ON CORE JAVA 9/11/09 CIS 120, Fall 2009 5
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
9/11/09 CIS 120 6 Java identifiers Variable, class and method names are identifiers Alphanumeric characters or _ starting with a letter or _ size myName MILES_PER_GALLON A1 the_end Interpretation depends on context: variables and classes can have the same name
Background image of page 6
9/11/09 CIS 120 7 Naming conventions kind part-of-speech identifier class noun RacingCar variable noun initialSpeed constant noun MAXIMUM_SPEED method verb shiftGear
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
9/11/09 CIS 120 8 Floating point gotcha Floating point division is not exact 2.0/3.0 0.6666666666666666 Floating point addition is not exact 3.65+0.05 3.6999999999999997 Floating point representation is not exact Can't represent 0.1 exactly with binary representations. Be careful when comparing floating point numbers for equality.
Background image of page 8
Java expressions Compute values of different types Numeric values: 9.3 + 1.0, p1.getX() String values: “hello “ + “world” Object values: new Point() Boolean values: 3.0 > 2.0 9/11/09 CIS 120 9
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
9/11/09 CIS 120 10 Comparisons Conditions that test the values of variables Equal : x == y x == 0 answer == 'y' Not equal : x != y x != 0.5 answer != 'y' Less than : x < y; not greater than: x <= y x < 0.5 x <= 0.5 Greater than : x > y; not smaller than: x >= y x > 0.5 x >= 0.5 Watch out for '=' instead of '=='
Background image of page 10
9/11/09 CIS 120 11 Combining conditions Boolean operators can be used to make more complicated conditions And : p && q income >= 50000 && income < 70000 Or : p || q isRaining || isSnowing Not : ! q !isRaining
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
9/11/09 CIS 120 12
Background image of page 12
Image of page 13
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 38

0914 - Introduction to Programming Languages and Techniques...

This preview shows document pages 1 - 13. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online