Java BigInteger variable -
in code have check if string valid number following
try{ new bigintger(numericstring); }catch(numberformatexception e) { throw numberformatexception; }
i know sort of hack/workaround whatever it, wanted know
new bigintger(numericstring)
must creating object in heap if assign value variable biginteger val = new bigintger(numericstring)
variable val
stored ?
it sounds basic not able imagine difference between two.
val
reference object itself, object stored in heap , pointer stored in stack.
the actual value of val
in stack address of object in hep.
the new
reserved word in java, says reference returned, in first case dont save object usual created in stack collected in short while. in second case, while val
still in stack , pointing object, stay in heap
Comments
Post a Comment