Friday 18 November 2011

How many objects you can create inside one program .

hello friends today i am with some different part of java  values of  " objects " . now the topic which i want to explain is " How many objects you can create inside one program . " so for this i just use my 2 hours but the thing is that i started from some other topic and ends in some other topic , so it is bad thing for me that i reached at different point , but the good thing is that i found another thing about java .

look how to make a start for this thing .
1. create a object
2. find its hash code using .... object_name.hashCode( ) ;

now look at the hash code which is found using the method of Object class and if you have time than please look up for Object class where you can find the method declaration like " public int hashCode()" so the main thing inside this declaration is " int " means its type is int , so  the method hashCode ( ) will always make a deal with integer values . means a value return by this method is int and which is treated as "object id " . by object id , manipulating is done in objects means objects are used . so this object id resides under integer limit means now we can only create objects whose maximum limit is Integer.MAX_VALUE .  and whose minimun limit is Integer.MIN_VALUE .

so you can create only 4294967295 objects in java .

No comments: