Why pointer concept not use in java?

Showing Answers 1 - 27 of 27 Answers

nitesh yetta

  • Jul 29th, 2006
 

memmory allocation is done automaticaly it is managed by Jvm

santi

  • Aug 2nd, 2006
 

 Because pointers are unsafe. Java uses reference types to hide pointers and programmers feel easier to deal with reference types without pointers. This is why Java and C# shine.

R.seethala saravanan

  • Aug 8th, 2006
 

because the cursor implementation concept is used in the java language.The pointer drawback is to identify and scratch the address very easily........

  Was this answer useful?  Yes

hi,

pointers are unsafe. pointers are complecated and difficult to use.if we use these concepts that the some of the features are not correct.so java soft designed like this.

ok bye.......keep in touch

do reply

keeps smiling and mailing

bora_srinivasarao@yahoo.co.in

"HELP EVER HURT NEVER"&"IMPOSSIBLE AS POSSIBLE"

Note:If any one want java materials like e-books,faq's send a mail to my id.if any doubts regarding java send a mail to my id, if possible i will send answers.if any one want how to install java softwares ,tomcat,weblogic,eclipse,jbuilder etc and how to use plz send amil or ask online also i will definitly tell.
see my profile by clickon below link:http://in.geocities.com/bora_srinivasarao/MyHomepage.html

devi

  • Aug 10th, 2006
 

java is created for simple use.But by adding pointer it is too complex for a programmer.So only for simplicity basis pointer is not included in java.

  Was this answer useful?  Yes

pankaj

  • Aug 13th, 2006
 

t's a common misconception that Java has no pointers. It's not exactly true. Java has pointers, they're just not explicit. Every object is a reference to a location making it a pointer... you just can't manipulate the pointers directly.in Java pointers are used by passing refference not by passing address directly ..

  Was this answer useful?  Yes

hariprasad dasari

  • Aug 31st, 2006
 

hi this is well for the student who are preparing for the interview.

  Was this answer useful?  Yes

Steve

  • Sep 22nd, 2006
 

A lot of this content is not accurate, so let me set the record straight here.

The Java language does _not_ provide pointers.  Instead, all objects are handled by references, not to be confused with pointers or C++ references.  The difference is that Java references do not refer directly to the memory location, but rather contain the pointer to the actual memory location, which the programmer cannot get direct access to.  This extra level of indirection is required for GC to work.  When GC kicks in and frees objects, that are no longer in use, it then does heap compaction to defragment the heap.  To do this, some objects must be moved around in memory.  This is possible because there is only one place where this pointer is located, in the reference, and thus the memory can be relocated, old location freed, and pointer changed.  In C++ this is not possible because pointers are copied all over the code.

It is also true that pointers are dangerous and lead to memory leaks, memory corruption, invalid memory access, e.g. from uninitialized and improperly initialized variables, indexing out of bounds, and many bugs due to pointer arithmetic.  References, and other features related to these, avoid all these problems.

Puneet

  • Oct 18th, 2006
 

Java Language does not use pointer for the reason that it works on Internet. Applets are used on the internet. and Pointers are used to identify the address of variables,methods, and therefore even big programmer can find out the secrets of other user on the internet using pointer. so if there could be  pointer in java, it could be harmful for leakage of the important information.

sureshkumar

  • Oct 23rd, 2006
 

hi devi

java is not a assembly programming and it is not required and unsafe to use

ok bye

keep n touch

sureshrit@sify.com

keep smiling

  Was this answer useful?  Yes

Anamika

  • Oct 23rd, 2006
 

hiJava does not support pointers (at least it does not allow you to modify the address contained in a pointer or to perform pointer arithmetic). Much of the need for pointers was eliminated by providing types for arrays and strings.anamika

  Was this answer useful?  Yes

suma

  • Jun 20th, 2007
 

Pointer concept is in Java. It internally invokes pointers.
It would be too complex when we use pointers. When we use pointers we will face some problems like memory leakage, eventhough when we retrieve the existing value from user-defined datatype(arrays,strings etc...) using pointers, it may be some garbage value...........

The pointer concept is not used in Java because, When we use the pointer and perform an Arithmatic operation like x++ which is in loop. Here we increase the address sometime which may not be alloted by our Application. This problem is handled in C++.
Also to free the memory allocated by object, we need a delete operator but Java not support the delete operetor. But we can use reference in it. When these references are not in use it will automatically free the memory.

  Was this answer useful?  Yes

Venkatesh

  • Jul 15th, 2011
 

- It's is not completely true that there is no use or concept pointer in java.

- There is no explicit pointer in Java so we can't manipulate it.

- All Objects we use is in Java is a reference .

  Was this answer useful?  Yes

garun mishra

  • Jan 22nd, 2012
 

Because of the security reason, as we know that Java programming is related with internet and a pointer stores
the address of variable. The hacker can hack our information by the pointing of address. So in Java, the pointer concept are not used.

  Was this answer useful?  Yes

CoolMoG

  • Jan 25th, 2012
 

Pointers ARE NOT unsafe (as some answers suggest) bad programmers are unsafe.

And BTW... C# can handle value and reference types

  Was this answer useful?  Yes

CoolMoG

  • Jan 25th, 2012
 

Contrary to many of the responses, No datatype is inherently unsafe. Bad programmers and bad programming practices are unsafe.

Java does so much housekeeping, like garbage collection and memory management, lack of a pointer facilitates implementation of those features. Think Im wrong? Imagine if you had a pointer in Java as well as all of the garbage collection and memory management features that Java provides. How safe would you feel referencing your pointers if Java could clean them up or rearrange memory on its own schedule? Java, like .NET keeps reference counts to things in memory. If you reference something through a pointer, you arent directly referencing the item. That would / could make it difficult for Java to track the references. What about pointers to pointers? What about even deeper indirection?

Lack of pointers is what makes the housekeeping in Java possible.

  Was this answer useful?  Yes

sanjay

  • Feb 17th, 2012
 

Java has pointers, they are not explicit, they are implicit

  Was this answer useful?  Yes

abhinav

  • Apr 7th, 2012
 

java uses the concept of reference variable which is same as pointer....

  Was this answer useful?  Yes

Kanchan

  • Apr 12th, 2012
 

java does not support pointer because of security purpose, as if it have pointer then till easy to find out the addressing of its application which may make it unsecure

  Was this answer useful?  Yes

SATYAJIT KUMAR

  • Jul 14th, 2012
 

Java does not support pointer or cannot allow pointers because doing so would allow java programs to breach the firewall between the java execution environment and the host computer

  Was this answer useful?  Yes

Man123

  • Jun 16th, 2015
 

Yes, Pointer is very important concept of C which helps us to directly access memory location and provide a way of passing values by reference and making permanent changes in variable values.

But, As pointers can directly access the memory locations so sometimes it can be dangerous to use them,any attacker may write program ruin all your computer memory data which can create big problem for users.So, In java concept of pointers is removed.

However, the same functionality can be achieved by creating object reference.

  Was this answer useful?  Yes

M.Alishair

  • Apr 20th, 2016
 

Why we do not use pointer in Java?

  Was this answer useful?  Yes

manoj

  • Dec 29th, 2016
 

Hi buddy! I need to known about wrapper class and its uses

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Answer Question

Click here to Login / Register your free account


 
Send   Reset

 

Related Answered Questions

 

Related Open Questions