






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







“pointers” are “references”
memory locations Docsity.com
HW 2 solutions on moodle
(See: MemoryEater.java)
If a variable references null, then you will crash your program if you use the reference
For example:
String x = null; int y = x.length();
If data is private, then it can only be changed through methods, right?
Classes are stored as references... If you give out its reference, then it can be changed (See: NextInLine.java and Counter.java) Docsity.com
If you want to not leak your private classes, make a copy of that class and give that out instead
This would not have been a problem if couter did not have a setCounter(x) method
(Remember if you cannot change the data, the class is called immutable, like String)
Java files in a packages are grouped together and you can see and use classes in the same package
javadoc gives descriptions of how classes, methods, etc. should be used
(See: SampleJavadoc.java)
To import other packages and/or JARs (other people's Java code) in NetBeans, simply right click on the “Libraries” in the package