Does creating more objects lead to more resource consumption in java?
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
timer.schedule(new TimerTask() {
@Override
public void run() {
Date date = new Date();
dateandtime.setText(dateFormat.format(date));
}
},0,1000);
I have this code and the application needs to run continuously for years. I am worried that with time resources used by the app may increase due to the creation of a new object every second.