Computer Science 1027A/B Lecture Notes - Lecture 28: Pseudocode, Javadoc, Local Variable

53 views45 pages

Document Summary

Objectives: to review the concepts and terminology of object-oriented programming, to discuss some features of object- oriented design. Review: revisit the person class public class person{ * and email address public person(string firstname, string lastname,string email) { this. lastname = lastname; this. firstname = firstname; this. email = email; Compared to python, in java one must explicitly give types to the attributes. Also note the difference between the keyword this vs python"s self. Example: person class: what methods might we want to have, accessor methods (aka getters, modifier methods (aka setters, tostring method (in python this is __repr__ or. __str_: equals method ( in python this is __eq__, two person objects are the same if they have the same first name and same last name. * setemail method sets the person"s setemail method sets the person"s email address. :param email: email address to set public void setemail (string email) { def setemail(self,email): this. email = email; self. email=email.