Anonymous

Why Pointers Are Not Used In Java?

5

5 Answers

John Peter Profile
John Peter answered
The main reason is that we will use java for developing windows application as well as web applications. If we use pointers, particularly for web applications we have a problem with security. Using Pointers we directly get access to the address directly in the system. If we use in web the users will be able to access your server and modify the address location of the data. This is a violation of security. So to prevent this pointers have been completely avoided in JAVA.
Virgo Nadia Profile
Virgo Nadia answered
The Java Language the referencing and dereferencing of objects is handled for you automatically. Java does not allow you to manipulate pointers or memory addresses of any kind. It does not allow you to cast object or array references into integers and It does not allow you to do pointer arithmetic. It does not allow you to compute the size in bytes of any primitive type or object. There are two reasons for these restrictions:

Pointers are a notorious source of bugs. Eliminating them simplifies the language and eliminates many potential bugs. Pointers and pointer arithmetic could be used to sidestep Java's run-time checks and security mechanisms. Removing pointers allows Java to provide the security guarantees that it does.

To a C programmer, the lack of pointers and pointer arithmetic may seem an odious restriction in Java. But once you get used to the Java object-oriented programming model, it no longer seems like a serious restriction at all. The lack of pointers does mean that you probably can't do things like write UNIX device drivers in Java (at least not without using native methods written in C). But big deal--most of us never have to do this kind of low-level programming anyway.
tarun singh Profile
tarun singh answered
Java is the language of internet.In other words you can say that it is a language of networks.
As we know that using pointers we can access any important data by pointing through pointers.And in networks & in java security is a preference.So Java does not use pointers.
Muddassar Memon Profile
Muddassar Memon answered
Well it's highly debatable to tell whether java does or does not support pointers. Quite a few believe that every reference type in java is a pointer, that's why the well known Null Pointer Exception. On the other hand the 1.5 version of Java supports pointer arithmetic.

Java basically is an object-oriented programming language which was created by Sun Microsystems during the 1990s. Java applications are normally assembled to bytecode, but compilation to local machine code is also possible. During runtime, bytecode is normally either construed or compiled to local code for functioning, but direct hardware implementation of bytecode via a Java processor is also possible.

Java got most of its syntax from other well known programming languages like C and C++, but comprises of a less complicated object model and diminutive low-level facilities.
Shumaela Rana Profile
Shumaela Rana answered
This is commonly known that the Java does not have any use of the pointers but this is not true. This language has the use of pointers but they are used explicitly and they can not be manipulated directly.

Answer Question

Anonymous