answersLogoWhite

0

Can you use pointers in java?

Updated: 8/17/2019
User Avatar

Anirvesh

Lvl 1
15y ago

Best Answer

Java does not support Pointers and hence you cannot use it in Java.

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Can you use pointers in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Do you use pointers in java?

no


What you use in case of pointer in java?

Java does not have pointers


What are the background pointers in java?

Java does not support pointers.


Pointers are replaced by what in java?

Nothing. Java does not have a concept that is equivalent to Pointers.


Why are they no pointers in java?

Pointers are a crucial feature of several programming languages, including C and C++, that allow direct manipulation of memory addresses. Pointers are used to create dynamic data structures, access memory directly, and create efficient algorithms. However, pointers are not available in the Java programming language. In this article, we will explore why pointers are not present in Java and the advantages and disadvantages of this decision. The main reason why pointers are not present in Java is security. Pointers allow direct access to memory addresses, which can be used to manipulate memory in unexpected ways. In Java, memory is managed automatically by the Java Virtual Machine (JVM), which helps to prevent accidental or intentional manipulation of memory. This is important for security, as malicious code could use pointers to gain unauthorized access to sensitive data or systems. By removing pointers, Java ensures that all memory access is controlled and managed, which helps to prevent security threats. Another reason why pointers are not present in Java is the ease of use. Pointers are a complex feature that can be difficult for beginner programmers to understand and use effectively. Java was designed to be an easy-to-use programming language, and by removing pointers, Java makes it easier for beginners to write correct, secure code. Java also makes it easier for programmers to write portable code, as the absence of pointers ensures that code written in Java will work on any device that supports the Java Virtual Machine. However, the absence of pointers in Java also has some disadvantages. One of the main disadvantages is that Java can be slower than languages that support pointers, as the automatic memory management provided by the JVM can be less efficient than direct memory manipulation. When handling large amounts of data, the JVM may not be able to allocate memory as efficiently as a programmer working directly with pointers. When working with pointers, a programmer has complete control over the memory allocation and can optimize it for their specific use case. Another disadvantage of the absence of pointers in Java is that some algorithms and data structures cannot be implemented as efficiently as they can be in languages that support pointers. For example, binary trees can and linked lists and are implemented more efficiently in C or C++, as they can use pointers to link nodes together in memory. Java must use other techniques, such as object references, to implement these structures, which can result in slower and less efficient code. In conclusion, the absence of pointers in Java was a deliberate decision made to improve the security and ease of use of the language. This decision has both advantages and disadvantages, as Java is easier to use and more secure, but it can be slower and less flexible than languages that support pointers. Nevertheless, the popularity of Java and its widespread use in industry and academia demonstrate that the benefits of the absence of pointers outweigh the drawbacks.


How pointers are used in java?

They aren't. Java uses the (safer) idea of references instead of pointers.


Important points of oops vs pop in java?

java is object oriented language.it's a platform independent.in java we don't use pointers


What is the difference between c plus plus and java programming?

Java doesn't have pointers. C++ has pointers.


In C you use the concept of pointers whereas there are no pointers used in JAVA why?

Pointers in C are generally the thing that gives learners the most trouble. When C code is not written correctly with respect to pointer use, the resulting bugs can often be very difficult to find and correct. On the other hand, pointers are absolutely necessary in some cases.The designers of Java wanted to make programming easier and hence avoided adding pointers to the language. Java does have object references which accomplish much of what pointers accomplish albeit in a safer way.


What is pointer in java?

There is no concept similar to pointers in Java. Pointers are a feature in C programming using which a programmer can access the memory. This was the cause of major catastrophic programming bugs. The creators of Java excluded this feature just to avoid such catastrophic bugs.


Can you use data structure in java?

Yes. Its just (sort of) like C and C++. The difference is that Java does not have pointers, it has references, but, philosophically, its the same thing.


Why does not use pointer in java?

You do not use pointers in Java because the language designers decided to abstract memory management to a higher level in Java than in C. The reason for this is that it is easy to make mistakes using pointers and other lower level memory management techniques. These mistakes can lead to bugs. hard to read code, memory leaks that waste system resources, and security issues. Instead for the most part Java takes care of memory management for the user who can instead specify behavior though the object oriented techniques that are safer and easier to understand. The downside is that the programmers lose some control and flexibility in using memory. Also, programs using Java take a small performance hit in some cases because of the extra work Java has to do to manage memory itself. They are, however in Java they are called references.