Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE 115 Week 11 March 24 - 28, 2008. Announcements March 26 – Exam 7 March 26 – Exam 7 March 28 – Resign Deadline March 28 – Resign Deadline Lab 7 turned.

Similar presentations


Presentation on theme: "CSE 115 Week 11 March 24 - 28, 2008. Announcements March 26 – Exam 7 March 26 – Exam 7 March 28 – Resign Deadline March 28 – Resign Deadline Lab 7 turned."— Presentation transcript:

1 CSE 115 Week 11 March 24 - 28, 2008

2 Announcements March 26 – Exam 7 March 26 – Exam 7 March 28 – Resign Deadline March 28 – Resign Deadline Lab 7 turned in by 3/30 can earn 20% bonus Lab 7 turned in by 3/30 can earn 20% bonus March 31 – Exam 8 March 31 – Exam 8

3 Week’s Notes Graphics package – see Javadocs Graphics package – see Javadocs We’ve used most things except for elements in the graphics package proper. If you want to “draw” on the drawing canvas, you need these elements. We’ve used most things except for elements in the graphics package proper. If you want to “draw” on the drawing canvas, you need these elements.

4 Week’s Notes Collections are containers that hold onto objects Collections are containers that hold onto objects Library of collections live in the java.util package in Java Library of collections live in the java.util package in Java Main functionality we need to be concerned with are: insertion, deletion, and search Main functionality we need to be concerned with are: insertion, deletion, and search

5 Week’s Notes In Java, when we create a collection, we need to state what type of thing is stored inside it. This changes slightly the look of a variable declaration. In Java, when we create a collection, we need to state what type of thing is stored inside it. This changes slightly the look of a variable declaration. java.util.Collection collectionOfStuff;

6 Week’s Notes When we have a collection and want to do something to all elements of that collection we use the for-each loop to help us iterate over all elements of that collection. When we have a collection and want to do something to all elements of that collection we use the for-each loop to help us iterate over all elements of that collection.

7 For-each loop syntax for(Type identifier1: identifier2) { //code to execute for each element } Where: Where: –identifier2 is the name of the collection that you are iterating over –Type identifier1 is the creation of a reference to each element of the collection to use as you are iterating.

8 Boolean expressions Expressions that evaluate to either true or false Expressions that evaluate to either true or false boolean is a type built into Java boolean is a type built into Java However, boolean is not a class However, boolean is not a class

9 Boolean values and operators Methods can return boolean values Methods can return boolean values Can combine boolean values using logic operators Can combine boolean values using logic operators && (logical and) || (logical or) ! (logical not)

10 Operators that return a boolean value Comparison operators return boolean values as well. These operators work on numeric values. Comparison operators return boolean values as well. These operators work on numeric values. < (less than) < (less than) > (greater than) > (greater than) <= (less than or equal to) <= (less than or equal to) >= (greater than or equal to) >= (greater than or equal to)

11 Operators that return a boolean value There are two equality operators in Java: There are two equality operators in Java: == (equality) != (not equal) These work on numeric values as you would expect from arithmetic These work on numeric values as you would expect from arithmetic But are also defined on references where they compare if the references are the same. But are also defined on references where they compare if the references are the same.


Download ppt "CSE 115 Week 11 March 24 - 28, 2008. Announcements March 26 – Exam 7 March 26 – Exam 7 March 28 – Resign Deadline March 28 – Resign Deadline Lab 7 turned."

Similar presentations


Ads by Google