varsha koli wrote:
So why not for Integer?
Ulf Dittmer wrote:... As to the answer, all options but #4 are highly likely to be identical, namely, calling the no-argument constructor. ...
fred rosenberger wrote:Doesn't it depend on what you mean by 'create an instance'? for example, de-serializing an object implies the object has already been created. It's like a balloon that has been deflated. Blowing it up doesn't "create" a balloon, does it? Or perhaps a better example is a piece of sheet music. Does the song exist when it's just written down, or does it only exist when it is being performed?
You cannot declare a new Exception without violating the Liskov substitution Principle. If the superclass' method is feasible without Exceptions then the subclass' method must be feasible without Exceptions.
The unchecked exception classes (ยง11.1.1) are exempted from compile-time checking.
Interfaces do not allow static blocks but do allow public final static member.
If someone wants to initialize the variable based on some logic, it is not possible in interfaces but possible in classes.
System.out.println("ArrayList :: "+thresholdElements);