Lecture 7
3
getters and setters
•Good
–private String    contents;
–public  String getContents()
–public    void setContents              (String contents)
–aTextFile.setContents(“foo”) in client class
•Watch naming conventions
•Bad (public access to field itself)
–public String contents;
–aTextFile.contents = “foo”  in client class