Public class Example {
    private int number;
    public Example(int number){
        this.number = number;
    }
    public int getNumber(){
        return number;
    }
    public void setNumber(int number){
        this.number = number;
    }
    public static void main(String[] args){
        Example e = new Example(5);
What is preffered when accessing a variable within its own class; "e.number" or "e.getNumber()" ?
Edit:
I think the most important question is: does the compiler know the method you call is a getter or setter. So, will e.setNumber(5); be as fast as e.number = 5;