Thursday, March 24, 2011

Initialling to zero rather than null

Some classes like BigDecimal,String have empty element into it. So we should use them nicely. Initialize these to zero, rather than null.

public void someFunc(BigDecimal p_number)
{
            BigDecimal m_number;
            m_number = p_number==null?BigDecimal.Zero : p_number;
}

No comments:

Post a Comment

Chitika