What is pointer and does Java support pointers

What is pointer and does Java support pointers ?

Answer :
Pointer: It is a object in programming where value directly points or refer to another value stored somewhere in the computer memory using by its address.

Java doesn’t supports pointers but as if somebody comes for C++ background their it supports pointer.

In place of pointer java supports “references”. Below are some big differences bewteen pointer in C and referece in java:

Pointer arithmetic is not possible in java. For example: Java supports reference so that we cannot “add” or “subtract”, we can only dereferencere it or compare it with another one.

Java is tightly type-safe and casting with incompatible type is not possible.

Leave a Reply

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

I am not Robot *