Why Java Does Not Support Pointers?

Below are some reasons why Java does not support pointers.

Although there are various advantages of pointer but it has several disadvantages that I have mentioned in the article.

 

 

Simple

The pointer concept is very confusing, difficult to understand (especially for beginners) and causes bugs in code. To make java simpler and less complex the java creators decided to remove the concept of pointers.

 

Secure

Security is one of the biggest issue in programming world. Pointer provides direct access to memory address. One can access some arbitrary memory location and do read and write operations on it. This results in loss of security. So to make java secure it doesn’t support pointers.

 

Memory Management

Pointers can be used to allocate and deallocate memory. This is good feature of pointers but sometimes it causes headache for programmers to manage memory manually. As java provides the automatic garbage collection feature so there is no need of pointers and it makes memory management easier.

 

Java doesn’t provide any explicit option to use pointers but internally pointers are used. Java has the concept of reference which is more simple and secure than pointer.

 

Comment below if you found any information incorrect or missing in above article.

3 comments

  • Santanu

    Java is an awesome language and after 10 years spending for SAP, I am now shifting towards Java Script. Thanks for creating this useful website.

    Reply
  • Hi Neeraj , throully you made a great website for beginers , congratulations !

    Reply
  • Andrew

    Pointers are optional.
    They however give you lots of power.
    You can literally never use them,,, but sometimes they are of great need.
    So telling me getting them out simplifies the language is like telling me : a car is so much more simple without wheels or engine ..

    And that is why making a kernel is JAVA is impossible. You don’t have pointers… that “headache giving” thing that controls memory…

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *