Lecture 6
20
getters and setters
•Good
–private String contents;
–public  String getContents()
–public  void setContents              (String contents)
–x = aTextFile.getContents() in client class
•Bad (public access to field itself)
–public String contents;
–x = aTextFile.contents in client class