![Page 1: 3.1 Documentation & Java Language Elements. 3.1.1 Purpose of documentation Assist the programmer with developing the program Assist other programers who](https://reader036.vdocument.in/reader036/viewer/2022062314/56649e025503460f94aed9ee/html5/thumbnails/1.jpg)
3.1 Documentation & Java Language Elements
![Page 2: 3.1 Documentation & Java Language Elements. 3.1.1 Purpose of documentation Assist the programmer with developing the program Assist other programers who](https://reader036.vdocument.in/reader036/viewer/2022062314/56649e025503460f94aed9ee/html5/thumbnails/2.jpg)
3.1.1 Purpose of documentation
• Assist the programmer with developing the program
• Assist other programers who wish to use or modify the program
![Page 3: 3.1 Documentation & Java Language Elements. 3.1.1 Purpose of documentation Assist the programmer with developing the program Assist other programers who](https://reader036.vdocument.in/reader036/viewer/2022062314/56649e025503460f94aed9ee/html5/thumbnails/3.jpg)
3.1.2 Guidelines for documenting classes
• Block comments – Start with /* and end with */. Can occupy multiple lines
• Single line comments – The line starts with //
![Page 4: 3.1 Documentation & Java Language Elements. 3.1.1 Purpose of documentation Assist the programmer with developing the program Assist other programers who](https://reader036.vdocument.in/reader036/viewer/2022062314/56649e025503460f94aed9ee/html5/thumbnails/4.jpg)
3.1.3 The javadoc parameters • The javadoc program can create HTML documents from
the comments in the program’s source file• To create javadoc comments,
use /** and */• Special tags can be imbedded in the comments
@author, @version, @param, @return, etc
![Page 5: 3.1 Documentation & Java Language Elements. 3.1.1 Purpose of documentation Assist the programmer with developing the program Assist other programers who](https://reader036.vdocument.in/reader036/viewer/2022062314/56649e025503460f94aed9ee/html5/thumbnails/5.jpg)
3.1.4 Java API documentation
![Page 6: 3.1 Documentation & Java Language Elements. 3.1.1 Purpose of documentation Assist the programmer with developing the program Assist other programers who](https://reader036.vdocument.in/reader036/viewer/2022062314/56649e025503460f94aed9ee/html5/thumbnails/6.jpg)
3.1.5 Generating API docs for classes using the javadoc tool
![Page 7: 3.1 Documentation & Java Language Elements. 3.1.1 Purpose of documentation Assist the programmer with developing the program Assist other programers who](https://reader036.vdocument.in/reader036/viewer/2022062314/56649e025503460f94aed9ee/html5/thumbnails/7.jpg)
3.2.2 Keywords • Keywords form the Java
vocabulary
• The compiler is case-sensitive
![Page 8: 3.1 Documentation & Java Language Elements. 3.1.1 Purpose of documentation Assist the programmer with developing the program Assist other programers who](https://reader036.vdocument.in/reader036/viewer/2022062314/56649e025503460f94aed9ee/html5/thumbnails/8.jpg)
3.2.3 Identifiers
• Labels assigned to data or storage addresses
• Rules for identifiers:– Any alphabetic character– First character must be a letter– Cannot contain space, % or #– Cannot be keywords
![Page 9: 3.1 Documentation & Java Language Elements. 3.1.1 Purpose of documentation Assist the programmer with developing the program Assist other programers who](https://reader036.vdocument.in/reader036/viewer/2022062314/56649e025503460f94aed9ee/html5/thumbnails/9.jpg)
3.2.4 Use of braces, semicolons, commas, and white space
• A block is a collection of statements bounded by braces { }
• A statement consists of one or more lines of code, followed by a semicolon ;
• Commas are used to delineate data
• Whitespace is used to separate keywords and identifiers
![Page 10: 3.1 Documentation & Java Language Elements. 3.1.1 Purpose of documentation Assist the programmer with developing the program Assist other programers who](https://reader036.vdocument.in/reader036/viewer/2022062314/56649e025503460f94aed9ee/html5/thumbnails/10.jpg)
3.3.1 Data storage introduction
• Registers – Memory in the CPU
• The Stack – Memory for methods and local variables
• The Heap – Memory to store objects
• Static – Stores data that will not change during the life of the program
• Constant – Values that never change.
![Page 11: 3.1 Documentation & Java Language Elements. 3.1.1 Purpose of documentation Assist the programmer with developing the program Assist other programers who](https://reader036.vdocument.in/reader036/viewer/2022062314/56649e025503460f94aed9ee/html5/thumbnails/11.jpg)
3.4.1 Java language types
• Data type is the classification of forms of information
• Data type is declared using keywords
• Java is strongly typed
![Page 12: 3.1 Documentation & Java Language Elements. 3.1.1 Purpose of documentation Assist the programmer with developing the program Assist other programers who](https://reader036.vdocument.in/reader036/viewer/2022062314/56649e025503460f94aed9ee/html5/thumbnails/12.jpg)
3.4.2 Java primitives
• boolean – true or false• char – Stores a single UNICODE character• byte – Signed whole numbers from -127 to +128• short – Signed whole numbers from -32,768 to +32,767• int - Signed whole numbers from -231 to 231 -1• long – Signed whole numbers from -9x1018 to 9x1018 -1• float – Decimal values up to 6 – 7 decimal places• double – Decimal values up to 14 – 15 decimal places
![Page 13: 3.1 Documentation & Java Language Elements. 3.1.1 Purpose of documentation Assist the programmer with developing the program Assist other programers who](https://reader036.vdocument.in/reader036/viewer/2022062314/56649e025503460f94aed9ee/html5/thumbnails/13.jpg)
3.4.3 Java references
• Objects are created in heap memory
• Programs use a variable that references the object
• The program acts on the object by using the reference
![Page 14: 3.1 Documentation & Java Language Elements. 3.1.1 Purpose of documentation Assist the programmer with developing the program Assist other programers who](https://reader036.vdocument.in/reader036/viewer/2022062314/56649e025503460f94aed9ee/html5/thumbnails/14.jpg)
3.4.4 Data
• Object Data – Instance of a class, stored on the heap
• Static Class Data – Available before the object is created
• Local Data – Exists in methods, stored on the stack
• Constants – Data that will not change• Variables – Holds a primitive or a
reference to an object
![Page 15: 3.1 Documentation & Java Language Elements. 3.1.1 Purpose of documentation Assist the programmer with developing the program Assist other programers who](https://reader036.vdocument.in/reader036/viewer/2022062314/56649e025503460f94aed9ee/html5/thumbnails/15.jpg)
3.4.4 Data (example)public class Student{ private final String studentName; public static final int courseNumber = 12345; public String grade; public Student(String name, String grd) { studentName = name; grade = grd; }
public void changeGrade(String grd) { grade = grd; } public String getName() { return studentName; }}
Try to Identify!!!!!1. Object
Data/Variable2. Static Data/Variable3. Local Data/Variable4. Constants
![Page 16: 3.1 Documentation & Java Language Elements. 3.1.1 Purpose of documentation Assist the programmer with developing the program Assist other programers who](https://reader036.vdocument.in/reader036/viewer/2022062314/56649e025503460f94aed9ee/html5/thumbnails/16.jpg)
3.5.2 Elements
• Class – Template or blueprint for object creation
• Method – A block of statements that control an object’s behavior
• Constructor – A special method that is called when the object is created
• Modifiers – private, public, protected, default, static, final
![Page 17: 3.1 Documentation & Java Language Elements. 3.1.1 Purpose of documentation Assist the programmer with developing the program Assist other programers who](https://reader036.vdocument.in/reader036/viewer/2022062314/56649e025503460f94aed9ee/html5/thumbnails/17.jpg)
constructor
method
class
3.5.2 Elements public class Student{ private final String studentName; public static final int courseNumber = 12345; public String grade; public Student(String name, String grd) { studentName = name; grade = grd; }
public void changeGrade(String grd) { grade = grd; } public String getName() { return studentName; }}
![Page 18: 3.1 Documentation & Java Language Elements. 3.1.1 Purpose of documentation Assist the programmer with developing the program Assist other programers who](https://reader036.vdocument.in/reader036/viewer/2022062314/56649e025503460f94aed9ee/html5/thumbnails/18.jpg)
3.6.1 Five steps of object creation
• Declaration of a reference variable
• Default initialization
• Explicit initialization
• Execution of the constructor
• Assignment of object’s address to reference variable
![Page 19: 3.1 Documentation & Java Language Elements. 3.1.1 Purpose of documentation Assist the programmer with developing the program Assist other programers who](https://reader036.vdocument.in/reader036/viewer/2022062314/56649e025503460f94aed9ee/html5/thumbnails/19.jpg)
3.6.3 Mutability, Garbage Collection & Finalizers
• Most data is mutable, and can be changed. To make it immutable, use the final keyword
• Garbage collection frees up memory occupied by unused objects. This process cannot be controlled
• Every object inherits a finalizer method, that will be executed when the object is released
![Page 20: 3.1 Documentation & Java Language Elements. 3.1.1 Purpose of documentation Assist the programmer with developing the program Assist other programers who](https://reader036.vdocument.in/reader036/viewer/2022062314/56649e025503460f94aed9ee/html5/thumbnails/20.jpg)
Individual activity & Lab Work
• Possible Lab Schedule every: – Monday, 15.00-16.50 or– Friday, 14.30 - 15.20 (PUSKOM-FTUI)
• TODO LIST (finished before next session):– Read through the online curriculum– Take the module exam 1 – 3 (Start: Thursday)– Do LABs:
• 3.1.6.1 Insert Documentation for Classes in the JBANK Application• 3.1.6.2 Generate API Docs for JBANK Classes with the javadoc Tool • 3.5.1 Define Variables• 3.5.9 Apply Access Modifiers • 3.6.1 Use of Constructors • 3.8.1 Create the Classes for Phase I of the JBANK Application
Note: Red bold color is obligatory to be submitted to ECourse System!