Is it legal to declare a variable in the constructor in java? example.
Time(){
long timeMill = System.currentTimeMillis();
int second = (int) (timeMill / 1000) ;
this.second = second % 60;
int minute = (int) (timeMill / 60);
this.minute = minute % 60;
int hour = (int) (timeMill / 360);
this.hour = hour % 24;
}