// this is overkill
Date now = new Date(System.currentTimeMillis());

Why is this overkill?

// this is overkill
Date now = new Date(System.currentTimeMillis());

Why is this overkill?

Because the default constructor for Date implicitly gets you a Date object reference referring to the system date/time at moment of creation.

Doing it like you do here is therefore redundant.

Sorry to post unrelated,but jwenting do you mind checking my java program really quick? (for an intro to java class). I have written it just wwant to confirm its right! (your private messaging is disabled so that's why I posted here. Sorry.

Student 09,

This is very bad to hijack someone else's post. Why don't you post it in a different thread? And why are you addressing directly to a particular member? Why not let the community help you?

Edited 6 Years Ago by johndoe444: n/a

BJSJC: You're looking at sql.date. java.util.Date says
Date()
Allocates a Date object and initializes it so that it represents the time at which it was allocated, measured to the nearest millisecond.

Comments
Oops! Thanks!
This article has been dead for over six months. Start a new discussion instead.