Why Java doesnot have Pointer ?

Asked by Last Modified  

19 Answers

Learn Java

Follow 0
Answer

Please enter your answer

Corporate trainer with 11 years of experience, Founder of Study9

The reasons are Pointers are fundamentally unsafe. Java has a robust security model and disallows pointer arithmetic.Java ensures pointer access via indexed array. A big advantage of Java's indexed array access is that it detects and disallows out of bounds array access, which can be a major source...
read more
The reasons are Pointers are fundamentally unsafe. Java has a robust security model and disallows pointer arithmetic.Java ensures pointer access via indexed array. A big advantage of Java's indexed array access is that it detects and disallows out of bounds array access, which can be a major source of bugs. Java has the concept of References to objects,but it just doesn't call them pointers. Any normal object reference works as one of these. When you do String s="Hello"; you get what is effectively a pointer to a string object. read less
Comments

Industry expert and professional lecturer/trainer

To avoid memory hacks and leaks it is an intentional decision taken by JAva Pioneers
Comments

Tutor - Maths and computer science

Because Java was built with safety in mind and pointers are a point of complexity(and thus failure) in a lot of programs if the developer is not careful. Java abstracts a number of things away from the developer to make things easier and safer for them, ie, garbage collection.
Comments

Expert Tutor

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...
read more
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. By not allowing pointers, Java provides effectively provides another level of abstraction to the programmer. read less
Comments

Do remove the complexity in programming
Comments

MCA

1. References store an address. That address is the address in memory of the object. So, when a class is declared like so: "PersonClass y = new PersonClass();", the "y" variable actually stores an address in memory. If you were to look at that address in memory you would see the details of...
read more
1. References store an address. That address is the address in memory of the object. So, when a class is declared like so: "PersonClass y = new PersonClass();", the "y" variable actually stores an address in memory. If you were to look at that address in memory you would see the details of the PersonClass object. Pointers in C++, however, point directly to the object. 2. You can not perform arithmetic operations on references. So, adding 1 to a pointer is not possible, but is possible in C++. read less
Comments

Professional Java J2EE Training with certification focus or Maths/English Tuition

Java manages memory in a different way compared to C++. It has automatic memory management and garbage collector. So it does not have a pointer again to confuse programmer and rather ease programming.
Comments

Java Techonologies

Having pointers creates a lot of changes for bugs in the code -- pointers can be quite confusing, especially to new programmers. By not allowing pointers, Java provides abstraction to the programmer. and also pointers in java are acheived thru reference variables in java whose References store an address...
read more
Having pointers creates a lot of changes for bugs in the code – pointers can be quite confusing, especially to new programmers. By not allowing pointers, Java provides abstraction to the programmer. and also pointers in java are acheived thru reference variables in java whose References store an address in memory where we can not perform any arithmetic operations on this reference variable(address) Animal a=new Animal(). a->Reference variable read less
Comments

Computer Engineer

Because Java does not provide direct memory manipulation rights to it's users. With help of pointers you are allowed to access memory directly which is not allowed in Java. That's why Java does not have any pointers. Java provides special classes to interact with system hardware.
Comments

IT Professional Trainer with 15 years of experience in IT Industry

To reference objects in java you use references. In other languages like C/C++ you use pointers. Pointers and references are used to point to objects in a program. In C/C++ you declare a pointer to point to a object or data type. Once you are done and no longer require the datatype or object, you...
read more
To reference objects in java you use references. In other languages like C/C++ you use pointers. Pointers and references are used to point to objects in a program. In C/C++ you declare a pointer to point to a object or data type. Once you are done and no longer require the datatype or object, you must release the pointer, otherwise it is pointing to something that no longer exists. This can occur during pointer arithmetic, or just forgetting to deallocate the pointer to null. This causes problems for memory management, and is more dangerous during run-time which can cause the program to crash; sometimes this can go undetected at compile time. Sun microsystems created and enforced references to make "pointing" safer to use in collaboration with the garbage collector memory manager that runs in the Java Virtual Machine. You do not have to explicitly declare or release objects, even if you made the error of forgetting to in your code, it is handled by the garbage collector. A reference can never point to nothing, it is either null or points to an object. The garbage collector, manages the allocation and release of memory and makes sure there is no referencless objects. This makes it safer. read less
Comments

View 17 more Answers

Related Questions

why string class is override in euals()/ hashCode Hethods?
• In the above program we compared two string using equals() method and it returns true.and comparing using == operator returns false. • Basically equal() will also return false on comparing those two...
Rami Reddy

What are major difference between JAVA & Python? Where you would recommend to use JAVA and where need to use Python?

Python is one of the most used programming language than Java. With the recent Popularity of the Machine learning, Artificial intelligence and Data science Python takes the first place of the Top 5 programming...
Amit Kumar
0 0
5

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Java :: Inner Class Concepts
Java:: Inner Class Concepts--------------------------------- Inner class concepts introduced in Java v1.1 - as a part of AWT Event Handling improvements.When to use Inner class: - Without existing One...
M

Marimuthu P.

2 0
0

Java Advantages
In this video, learn about Java and its advantages. Also, check out the difference between Java and C++, Java development kit, Java Run Time Environment (JRE) with a proper demonstration program for better clarity.

Migration from other languages to Salesforce
Anyone can easily migrate from other language to Salesforce. People must have skills to understand business logic.

2.1. Reverse a singly linked list.
class Node { int data; Node next; Node(int data) { this.data = data; this.next = null; }} public class LinkedList { Node head; public void reverse() { Node prev = null; Node curr = head; Node next =...

1.3. Find the second largest element in an array.
public class Main { public static void main(String args) { int arr = {1, 3, 4, 6, 5}; int max = Integer.MIN_VALUE, secondMax = Integer.MIN_VALUE; for (int i = 0; i < arr.length; i++) { if (arr >...

Recommended Articles

Designed in a flexible and user-friendly demeanor, Java is the most commonly used programming language for the creation of web applications and platform. It allows developers to “write once, run anywhere” (WORA). It is general-purpose, a high-level programming language developed by Sun Microsystem. Initially known as an...

Read full article >

In the domain of Information Technology, there is always a lot to learn and implement. However, some technologies have a relatively higher demand than the rest of the others. So here are some popular IT courses for the present and upcoming future: Cloud Computing Cloud Computing is a computing technique which is used...

Read full article >

Java is the most famous programming language till date. 20 years is a big time for any programming language to survive and gain strength. Java has been proved to be one of the most reliable programming languages for networked computers. source:techcentral.com Java was developed to pertain over the Internet. Over...

Read full article >

Java is the most commonly used popular programming language for the creation of web applications and platform today. Integrated Cloud Applications and Platform Services Oracle says, “Java developers worldwide has over 9 million and runs approximately 3 billion mobile phones”.  Right from its first implication as java 1.0...

Read full article >

Looking for Java Training Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you