+2 votes
asked Oct 19, 2015 in Computer Science - IT by kishor93 | 144 views

1 Answer

+1 vote

Java doesn't have pointers; Java has references.

No, Java does not have pointers. This was an intentional decision by the creators of Java, because most people would agree that having pointers creates a lot of potential for bugs in the code – pointers can be quite confusing, especially to new programmers. Because arrays and strings are provided as class types in Java, there is no need for pointers to those constructs.

Java has pointers in the sense of variables that store references to data in memory. All variables of Object types in Java are pointers in this sense.

However, the Java language does not allow arithmetic operations on the values of pointers, like you'd be able to do in a language like C.

http://www.oracle.com/technetwork/java/simple-142616.html

answered Oct 19, 2015 by slow_learner