Header Ads

  • Breaking Now

    Why Java does not support pointers?

    As per the design decision Java does not support pointers explicitly.This greatly reduces the burden of dynamic memory management while coding from programmers.Though programmers dynamically allocate memory while coding but they need not worry about deallocating this memory.The automatic garbage collection feature of Java collects dangling references of objects though it has a trade off on performance as programmer managed memory management will be efficient as compared to JVM driven automatic garbage collection.

    4 comments:

    1. The garbage collection point is true, but don't we also need to mention the fact that pointers would make the programs more closely coupled with the system, which would kill the purpose of platform independence in Java?

      ReplyDelete
    2. bal chal question..java doesn't support the pointer concept..because jvm takes care of memory allocation by itself..so a programmer need not have to worry about allocating or reallocating of memory...

      ReplyDelete
    3. Most studies agree that pointers are one of the primary features that enable developers to inject bugs into their code. When Java was created, the intention was to create a language that is easy to learn and not prone to the bugs that C++ is prone to. It's not like c/c++ where we have to manage the memory management by destructors. In java automatic Garbage Collector works for memory management. Actually, Java references are pointers so everything in Java is accessed only through pointers.

      Check this....Some reasons for Java does not support Pointers

      Ling

      ReplyDelete
    4. Thanks for sharing nice information with us. i like your post and all you share with us is uptodate and quite informative, i would like to bookmark the page so i can come here again to read you, as you have done a wonderful job.  Secrailway

      ReplyDelete

    Post Top Ad

    Post Bottom Ad