{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

0914 - Introduction to Programming Languages and Techniques...

Info icon This 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
Image of page 1

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

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

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

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

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

View Full Document Right 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
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
Image of page 7

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

View Full Document Right 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.
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
Image of page 9

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

View Full Document Right 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 '=='
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
Image of page 11

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

View Full Document Right Arrow Icon
9/11/09 CIS 120 12 Short circuiting
Image of page 12
Image of page 13
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern