Can we declare pointers in Java?

No, Java does not support explicit pointers like C or C++. Developers cannot directly access or manipulate memory addresses in Java. This design choice improves security, reliability, and portability.

Key Points

Example

In C++, a developer can store and manipulate memory addresses using pointers. In Java, objects are accessed through references, but the actual memory address remains hidden from the programmer.

class Employee {
}

public class Main {

    public static void main(String[] args) {

        Employee emp = new Employee(); // emp is a reference, not a pointer
    }
}

Common Mistakes

Follow-up Questions

Interview Tip

A concise interview answer is

No, Java does not support explicit pointers. Instead, it uses object references to access objects. This restriction improves security, prevents direct memory manipulation, and makes memory management easier through automatic garbage collection.

Last updated: 11 November 2026

Previous question: Can primitive data types be null in Java?

Next question: What are wrapper classes in Java?

More Core Java - Level II interview questions

All Core Java - Level II questions