An attempt to put my random thoughts on the piece of page...

Monday, August 8, 2011

True life cycle of an Object!!!

   

    for (int day=1; day<=5; day++)  {

        // Object... please wake up!! Its office time (Total time (hrs) = 0)

        Object.notify();

        int hrs=0;

        // Object... please get ready for office (Total time (hrs) = 1)

        for (hrs=0; hrs<=1; hrs++) {

           Object.STATE = GET_READY;

        }

        // Object... will travel for 2 hrs to office (Total time (hrs) = 3.5)

        hrs = 2.5;

        Object.run(int hrs);

        // Object... will work for 12 hrs (Total time (hrs) = 15.5)

        hrs = 12;

        Work(Object obj, int hrs);

        // Object... will travel for 2 hrs from office (Total time (hrs) = 18)

        hrs = 2.5;

        Object.run(int hrs);

        // Object... will sleep now (Total time (hrs) = 24)

        hrs = 6;

        TimeUnit.HOURS.sleep(hrs);

        // release all allocated memory (old) so that new information can be taken up in memory :)

        Object.finalize() ;

    }