COMP SCI 300- Midterm Exam Guide - Comprehensive Notes for the exam ( 28 pages long!)

296 views28 pages

Document Summary

Take subtasks, label them, use those labels to hide unnecessary details . Lecture 2: debugging techniques, compartmentalize your code. Sc2 often wont get the input we type in because sc has already retrieved it. Lecture 3 objects: storing java variables, stack - location of all variables names here, static memory - things that never change (ie code or const. Data is in the heap: passing arguments, java passes arguments to the methods by value, primitive type. The value is all the data i[o] dosomething(i); we hand o to the method and nothing in the method can change i: arrays. The called method can change the variable in the parent method: string. We pass a reference, but we cannot modify said data. Additional methods defined for integer: aliasing, when we have two variables in the stack refer to the same location in the heap, this is the only time (a==b) is true, in general a. equals(b) or a. compareto(b)