====== Week 2 ====== ~~NOTOC~~ ===== Introduction / Science of Abstraction ===== * Office hours: posted! * (continued from slide 8) * Lecture notes: {{courses:cs203-201301:203-introduction.pdf|203-introduction.pdf}} \\ \\ ===== Understanding Objects in Java ===== **Origins of Java (sidebar 2.1)** ((Liskov p. 16)) * Java is a successor to Scheme and SmallTalk (among other languages). * Java is only superficially (syntactically) similar to C and C++. Semantically, Java is very different from these and other languages. **Packages** ((Sestoft pp. 72-73)) * Java source files may be organized into //packages//. Every source file in package ''p'' must begin with the declaration package p; and must be stored in a subdirectory called ''p''. * A class declared in a source file with no ''package'' declaration belongs to the anonymous //default package//. * Our BlueJ projects last year in 102 were all //default package// projects, but the projects we create in Netbeans this semester will all have explicit ''package'' declarations. * Class ''C'' within package ''p'' may be imported explicitly usingimport p.C; or all classes within package ''p'' may be imported using wildcard notation: import p.*; * Let's take a look at named and default packages in Netbeans. **Objects and Variables** ((Liskov Section 2.3)) * Stack and Heap diagrams figure 2.2 (p. 19) * Exercises 2.1, 2.2, 2.3, 2.4 * //Exercises 2.1, 2.2, and 2.3 are HW for next Monday's class/