






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An in-depth exploration of java references, packages, javadoc, and their significance in java programming. Topics covered include managing references, copying references, leaking references, debugging, and packages with javadoc and importing. Understand how to master references, avoid memory leaks, and effectively use packages and javadoc.
Typology: Slides
1 / 11
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