Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS240: Advanced Programming Concepts

Similar presentations


Presentation on theme: "CS240: Advanced Programming Concepts"— Presentation transcript:

1 CS240: Advanced Programming Concepts
Week 2 Thursday

2 Topics Final values Wrapper classes and Autoboxing Arguments
More on Arrays “==“ vs “.equals()” Lab 2 walkthrough

3 “Final” Values Set once then immutable…

4 Primitive Data Types and Wrapper Classes
Sometimes you just need an object… Enter wrapper classes for primitive data types Autoboxing and unboxing allows us to “ignore” the wrapper and treat the variable like a primitive (i.e. static declarations/allocations)

5 Argument Passing Pass by value… Arrays as arguments and return types…
Primitives References Arrays as arguments and return types…

6 More on Arrays Arrays as arguments and return types… Arrays of
References Primitives Can I truly have an array of objects? – no not really, I’ll get an array of references that must be associated with individually allocated objects, the memory is dynamically allocated on the heap so I don’t really know if it is contiguous.

7 “==“ vs “.equals()” “==“ looks at the value of the variables. What does this mean for primitives? references? .equals() Tests an “equivalence relation” Related to hashCode()

8 Lab 2 Read/Walk Through (To be continued)
Trie data structure Characters as indexes Use a char Use a hashmap Methods to override… Equals method() – review hashCode… Similarity of words Cumulative edit distance <= 2 Four edit distances Deletion Transposition (adjacent) Alteration Insertion


Download ppt "CS240: Advanced Programming Concepts"

Similar presentations


Ads by Google