UMD CMSC 131  Lecture 15: Review of Aliasing & Mutability, Floating Point Calculations (7 pages)
Previewing pages 1, 2 of 7 page document View the full content.Lecture 15: Review of Aliasing & Mutability, Floating Point Calculations
Previewing pages 1, 2 of actual document.
View the full content.View Full Document
Lecture 15: Review of Aliasing & Mutability, Floating Point Calculations
0 0 96 views
Lecture Notes
 Pages:
 7
 School:
 University of Maryland, College Park
 Course:
 Cmsc 131  Objectoriented Programming I
Objectoriented Programming I Documents

14 pages

19 pages

Lecture 13: Libraries and Encapsulaton
14 pages

18 pages

Lecture 12: Runtime Management
3 pages

Lecture 16: Method Overloading
14 pages

Lecture Set 5: Design and Classes
16 pages

Lecture 21: Algorithms and Design
7 pages

Lecture 10: Static Methods and Variables
4 pages

30 pages

Lecture 17: Ternary Operator, Switch, Break, Continue
10 pages

Lecture 17: Ternary Operator, Switch, Break, Continue
10 pages

Lecture 14: Libraries and Encapsulaton
15 pages

5 pages

Lecture Set #13: Args Array and Commenting Review
2 pages

9 pages

Lecture 6: IfElseIf and Loops
23 pages

2 pages

17 pages

6 pages

Lecture 15: IntraClass Method Calling
12 pages

9 pages

7 pages

18 pages

13 pages

2 pages

Lecture 6: IfElseIf and Loops
26 pages

16 pages

12 pages

Lecture 18: Implicit Promotion
28 pages

12 pages

Lecture 9: Objects and Classes in Java
7 pages

Lecture Set 4: More About Methods and More About Operators
7 pages

Lecture Set #7: Exceptions & Mutability Issues
6 pages

Lecture 22: More on Array Operations
13 pages

13 pages

26 pages

5 pages

Lecture Set #16: Command Line Running Issues & Comments
3 pages

4 pages

Lecture 21: Algorithms and Design
19 pages

18 pages

Lecture Set #14: Algorithms and Design
6 pages

7 pages

7 pages

20 pages

3 pages

6 pages

6 pages

Lecture 10: Objects and Classes in Java
18 pages

19 pages

Lecture Set 5: Design and Classes
15 pages

Lecture Set #14: Algorithms and Design
8 pages

8 pages

18 pages

5 pages

Lecture 9: Objects and Classes in Java
20 pages

22 pages

Lecture 10: Static Methods and Variables
11 pages

2 pages

12 pages

10 pages

Lecture 9: Introduction to Objects and Classes
20 pages

Lecture Set 4: More About Methods and More About Operators
11 pages

12 pages

Lecture Set #3: Java Expressions
5 pages

Lecture 12: Static Methods and Variable
10 pages

7 pages

Lecture Set #15: TwoDimensional Arrays
3 pages

22 pages

Lecture 17: Implicit Promotion
14 pages

5 pages

17 pages

Lecture Set #11: Polymorphism Introduction
4 pages

19 pages

Lecture Set #3: Java Expressions
14 pages

Lecture Set 6: Static Methods & Variables and Exceptions
6 pages

3 pages

Lecture 12: Runtime Management
7 pages

7 pages

19 pages

Lecture 8: Introduction to the Heap and Garbage Collection
5 pages

Lecture 8: Introduction to the Heap and Garbage Collection
15 pages

Lecture Set 6: Static Methods & Variables and Exceptions
9 pages

13 pages

Lecture Set #10: TwoDimensional Arrays
5 pages

9 pages

6 pages

8 pages

17 pages

16 pages

Lecture 15: Review of Aliasing & Mutability, Floating Point Calculation
3 pages

14 pages

14 pages

14 pages

3 pages

Lecture Set 4: Evaluation Order
6 pages
Sign up for free to view:
 This document and 3 million+ documents and flashcards
 High quality study guides, lecture notes, practice exams
 Course Packets handpicked by editors offering a comprehensive review of your courses
 Better Grades Guaranteed
Unformatted text preview:
Lecture 15 Review of Aliasing Mutability Floating Point Calculations Last time 1 Unit testing and JUnit 2 Constructors revisited 3 equals Today 1 Project 4 assigned 2 Aliasing and Mutability 3 Floating Point calculations 4 Example class development Rational Numbers CMSC 131 Fall 2007 Jan Plane adapted from Bonnie Dorr Project 4 Is Assigned It is due Wednesday 10 31 at 11 00PM The project is closed You must complete the project by yourself Assistance can only be provided by teaching assistants TAs and instructors You must not look at other students code Start now Read entire assignment from beginning to end before starting to code Check out assignment now from CVS Follow the instructions exactly CMSC 131 Fall 2007 Jan Plane adapted from Bonnie Dorr 1 Taking Care of Corner Cases FancyWord example from Friday String of was a corner case that we needed to test for Write new test cases or new asserts in the test cases that already exist to take care of this What about null references as corner cases public void testNullAndEmpty FancyWord a new FancyWord null assertEquals null a toString FancyWord b new FancyWord assertEquals b toString CMSC 131 Fall 2007 Jan Plane adapted from Bonnie Dorr 2 What about Strings and Aliasing String objects are immutable fields cannot be changed once created Mutable objects fields values of instance variables can be changed e g Cat Student etc Immutable objects fields values of instance variables cannot be changed See String API http java sun com j2se 1 3 docs api java lang package summary html In this example y is created as an alias for String x b is created as an alias for Cat a but the results are different x Jan Plane y Jan Fluffy has been created Fluffy has been eaten Fluffy has 8 more lives a Fluffy 8 lives b Fluffy 8 lives CMSC 131 Fall 2007 Jan Plane adapted from Bonnie Dorr 3 Which picture represents the current status of memory Stack Heap cat a b Stack Heap cat a b Fred Fred CMSC 131 Fall 2007 Jan Plane adapted from Bonnie Dorr 4
View Full Document