java - Getter for mutable object -


i read many articles how write right getter/ setter mutable object date or array. when changed on

    public date getdateto() {         return (date) dateto.clone();     }      public void setdateto(date dateto) {         this.dateto = (date) dateto.clone();     } 

i java.lang.nullpointerexception. means shoul initialize date in (post)constructor?

it dateto not constructed, there nothing clone. answer yes - should initialize it.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -