my date format changes according to certain conditions, in order to have global access I initialize them and then assign a value according to condition.
But looking at De-bugger these values are not being re-assigned, they remain null as per initialization.
I am new to java what is the assignment behavior that is causing this ?
Here's code:
SimpleDateFormat df = null;
SimpleDateFormat df2 = null;
SimpleDateFormat date_c = null;
SimpleDateFormat t = null;
SimpleDateFormat t2 = null;
SimpleDateFormat df5 = null;
SimpleDateFormat df3 = null;
if ( make == "NCR")
{
df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
df2 = new SimpleDateFormat("yyyyMMddHHmmss");
date_c = new SimpleDateFormat("yyyyMMdd");
t = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
t2 = new SimpleDateFormat("yyyyMMddHHmmss");
df5 = new SimpleDateFormat("yyyyMMddHHmmss");
df3 = new SimpleDateFormat("yyyyMMddHHmmss");
}
else if ( make == "WINCORE")
{
df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S");
df2 = new SimpleDateFormat("yyyyMMddHHmmssS");
date_c = new SimpleDateFormat("yyyyMMdd");
t = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S");
t2 = new SimpleDateFormat("yyyyMMddHHmmssS");
df5 = new SimpleDateFormat("yyyyMMddHHmmssS");
df3 = new SimpleDateFormat("yyyyMMddHHmmssS");
}