1 public class Student
2 {
3 private String name;
4 private int id;
5
6 public Student(int anId) { id = anId; }
7 public String getId() { return id; }
8 // No setId method
9
10 public String getName() { return name; }
11
12 public void setName(String newName)
13 {
14 if (newName.length() > 0) { name = newName; }
15 }
16 }