-
Java not support pointers ?
Hello Dear,
Please Tell Me Why does Java not support pointers ?
-
The first and very important reason is the security. The concept of Pointers in C-lang is often misused and is probably the biggest reason for people considering C-lang a complicated programming language.
-
Hi Friends,
A pointer is a datatype used to store address of a memory location.
It is a misconception that Java doesn't have pointers. It has pointers but it doesn't allow the user to manipulate pointers like in lower level languages like C and C++. You simply cannot perform pointer arithmetic in Java while as in C you can. It means that Java doesn't give access to raw memory. That is because Java runs on JVM (Java Virtual Machine) making it a universal language.
-
Pointers are special variables responsible for memory manipulations. Since everything on computer are stored in memory, they provide an excellent way to handle them ( or mess up them). Java does use pointers internally, it is just java doesn't allow users to access them ( for security purposes) hence uses references ( which are safer)
-
As you know, each variable is a memory location and each memory location has a given address that can be accessed via an ampersand (&) operator which denotes a memory address. Pointer is a function whose value is the address of a separate variable, i.e. the memory location's direct address. You must declare a reference, like any variable or constant, before using it to store any variable address. The general form of a pointer variable statement is − type* var-name; type is the base type of the pointer; it must be a valid C type of data and var-name is the pointer variable's name. The* asterisk used to mark a pointer is the same asterisk used to multiply.
Java has no pointers, it's a common misconception. It's just not true. Java's got points, they're not clear. Every object is a reference to a location that makes it a pointer... You can't directly control the pointers. For Java, reference points are used not by explicitly forwarding the address
-
Java does not support pointers ... because to reduce the complexity and improve the robustness of the java language does not support pointers.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks