title: Getter and setters to be made private or public?
body: <p>I can really find any information on this..</p>
  
  <p>Should getters and setter be made private or public?</p>
  
  <pre><code>import java.util.ArrayList;
  
  
  public class StudentRecords {
  
    //private strings, ints and doubles
    private String name, subject;
    private int studentNo, level;
    private double avg, total;
  
  
    //constructor that sets name, studno...
    public StudentRecords(String name, int studentNo, String subject, int level, ArrayList&lt;Double&gt; grades){
  
      setName(name);
      setStudentNo(studentNo);
      setSubject(subject);
      setLevel(level);
      setAverage(grades);
  
    }
  
  
  
    public void setAverage(ArrayList&lt;Double&gt; grades) {
  
      for(int i = 0; i &lt; grades.size(); i++){
          total += grades.get(i);
          avg = total/level;
      }
    }
  
  
    private void setName(String name){
  
      this.name = name;
  
    }
  
    private void setLevel(int level){
  
      this.level = level;
  
    }
  
    //public 
    public void setSubject(String subject){
  
      this.subject = subject;
  
    }
  
    private void setStudentNo(int studentNo){
  
      this.studentNo = studentNo;
  
    }
  
  
     public String toString() {
      return ("Student Name: "+ this.name +"\nStudent subject: "+this.subject + "\nStudent Number: " + this.studentNo + "\nStudent level: " + this.level + "\nAverage Grade: "+ avg +"\n\n");
     }
  
  }
  </code></pre>