CSE 8A Chapter Notes - Chapter 11.5-11.7: Javadoc

25 views2 pages

Document Summary

11. 5 creating accessors (getters) and modifiers (setters) Access private fields in a class with getters and set them to different values with setters: creating public methods that access private fields public string getname() { return this. name; This (cid:272)ode retur(cid:374)s the stude(cid:374)t o(cid:271)je(cid:272)t"s name as a string. Although the field for name is private, we can access them with this public method public void setname(string name) { this. name = name; This code allows us to manipulate private fields. We (cid:373)ust pass a stri(cid:374)g i(cid:374)to this (cid:373)ethod, the(cid:374) it will set the stude(cid:374)t o(cid:271)je(cid:272)t"s name to the string we pass in. Encapsulation data grouped with methods that affect it in class. 11. 6 creating a main method public static void main(string[] args) Javadoc utility giving us the ability to create html docs from special javadoc comments in source code: comments are written in normal language so that we and others can read and reuse them without confusion.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents