COMP 202 Lecture Notes - Lecture 20: Concatenation
jc123 and 40170 others unlocked
100
COMP 202 Full Course Notes
Verified Note
100 documents
Document Summary
Strings are not primitive types, even if we"ve been using them as if they were. Arrays are regular reference types -- some people call them mutable . Immutable : you can not change the contents of a variable of type string after creating it. But we kind of feel like we have done this String phrase = cats ; phrase = phrase + dogs ; It looks like we are changing the value of a string after creating it! Immutable reference types are more secure, and more intuitive to use. Their behavior essentially mimics the behavior of primitive types. Midterm review (questions people got wrong) int[][] a = {{1,2,3}, {1,2}, null, {4,5,6,7}}; for(int i=0; i