Pointer in java

Pointer in java

View Answers

January 10, 2012 at 11:07 AM

**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.**









Related Tutorials/Questions & Answers:
is there is pointer in java or not??
is there is pointer in java or not??  is there is pointer in java or not plz tell me this with brief?? thank you
null pointer exception in java
null pointer exception in java  What is null pointer exception in Java and when it occurs? Show it with an example.Thanks!   Java Null Pointer Exception
Advertisements
pointer error java
pointer error java  How to catch null pointer errors in java if the if(value != null) or null
Pointer in java - JSP-Servlet
Pointer in java   Hello ! All i know that java has no pointer type facility. but i have a problem to related pointer. Actually m using a dll and in that dll there is function that rec add of byte type variables address
what is a null pointer exception in java
what is a null pointer exception in java  what is a null pointer exception in java
pointer
pointer  CONSTRTUCT A STRUCTURE FOR EMPLOYEE RECORD THAT CONTAINS A PERSON'S NAME, AGE, EMPLOYEE AND SALARY.WRITE A STATEMENT THAT DECLARES A VARIABLE empInfo and a pointer emPtr of type EMPLOYEE.then use the pointer to display
Java null pointer exception
Java null pointer exception  Hi I've made an array of Book objects that I made, the array is called library and it can hold 100 books, but currently there are 6. The Book objects contain three private strings; an author, a title
Java null pointer exception handling
Java null pointer exception handling   What is a java.lang.NullPointerException? Why do we use this exception class and when it occurs in any java... pointer exception handling What is Java NullPointerException? In Java
Null Pointer Exception - Java Beginners
Null Pointer Exception  How Can I Handle NullPoiniterException without using try/catch mechanism
What is a pointer and does Java support pointers?
What is a pointer and does Java support pointers?   Hi, What is a pointer and does Java support pointers? Thanks   Hi, Pointer.... for more related to [Java Pointer][1] [1]http://www.roseindia.net
Why the null Pointer exception is comming? - Java Beginners
Why the null Pointer exception is comming?  My code is given below: import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import
Pointer a variable
Pointer a variable  hii, Pointer is a variable or not ?   hello,ADS_TO_REPLACE_1 Yes, a pointer is a variable
null pointer
null pointer  dear sir , what is mean by null pointer in c
when do we get null pointer exception in java
when do we get null pointer exception in java  can anybody explain me abt null pointer exception? like in wt situation do v get NPE? Are these 2 strings same? String str; String str=null
pointer to a reference
pointer to a reference  pointer to a reference in C++    #include <iostream> using namespace std; void foo1(int& x) { int* p = &x; *p = 123; } void foo2(int* x) { int
pointer to a reference
pointer to a reference  pointer to a reference in C++    #include <iostream> using namespace std; void foo1(int& x) { int* p = &x; *p = 123; } void foo2(int* x) { int
Null Pointer Exception
Null Pointer Exception  whis is the Null Pointer Exception in java? or define Null Pointer Exception with exp?   NullPointerException occurs, when you try to implement an application without referencing the object
Function pointer in c
Function pointer in c  What is the difference between function call with function pointer and without function pointer(normal function call
Null pointer execption
Null pointer execption  what is null pointer exception. I am getting the null pointer exception in this line conn= com.mypay.dao.Connection.getConnection(); what is wrong
Null pointer execption
Null pointer execption  what is null pointer exception. I am getting the null pointer exception in this line conn= com.mypay.dao.Connection.getConnection(); what is wrong
c-language pointer functions
c-language pointer functions  what is the execution process of character pointer functions with example
ModuleNotFoundError: No module named 'pointer'
ModuleNotFoundError: No module named 'pointer'  Hi, My Python... 'pointer' How to remove the ModuleNotFoundError: No module named 'pointer... to install padas library. You can install pointer python with following command
Null Pointer Exception
Null Pointer Exception        Null pointer exceptions are the most common run time  exception error arises during execution of java program. All values in Java
incomplete pointer type NSMutableDictionary
incomplete pointer type NSMutableDictionary  My iphone app is throwing the "incomplete pointer type NSMutableDictionary" issue on running the iphone app. What is this issue and how can i remove it. NSMutableDictionary *dict
Httpservletresponse null pointer exception.
Httpservletresponse null pointer exception.  What is Httpservletresponse null pointer exception?   NullPointerException occurs when we try to implement an application without referencing the object and allocating
NULL POINTER EXCEPTION
NULL POINTER EXCEPTION    What is the Root cause for Class caste exception in struts frame work .and how 2 handle that 1 please help me
Null pointer exceptation-Java Servlet web application,Problem connecting with MYSQL database
Null pointer exceptation-Java Servlet web application,Problem connecting.... T_T I have develop my java web application in window Environment and now i.... T_T I have develop my java web application in window Environment and now i
ModuleNotFoundError: No module named 'json_pointer'
ModuleNotFoundError: No module named 'json_pointer'  Hi, My Python... 'json_pointer' How to remove the ModuleNotFoundError: No module named 'json_pointer' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'json_pointer'
ModuleNotFoundError: No module named 'json_pointer'  Hi, My Python... 'json_pointer' How to remove the ModuleNotFoundError: No module named 'json_pointer' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'sky-pointer'
ModuleNotFoundError: No module named 'sky-pointer'  Hi, My Python... 'sky-pointer' How to remove the ModuleNotFoundError: No module named 'sky-pointer' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'json_pointer'
ModuleNotFoundError: No module named 'json_pointer'  Hi, My Python... 'json_pointer' How to remove the ModuleNotFoundError: No module named 'json_pointer' error? Thanks   Hi, In your python
NUll POINTER EXCEPTION
NUll POINTER EXCEPTION  public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException... of code i m getting null pointer Exception. can some one please explain what
null pointer exceptions
null pointer exceptions  import java.util.*; public class employee { static int ch; static int emp[]; String name; int id,age; float sal; void insert() { employee[] emp=new employee[90]; Scanner r
null pointer exception in jsp
null pointer exception in jsp  index.html <html> <body> <table align=center> <form action="Login.jsp" method="get"> <tr> <td colspan=2><h1>Student Login</h1></td><
null pointer error
null pointer error  Respected sir there is a problem in this code when i add any new record in ms access data base from my code, it gives only null pointer error sir please help me my code are given below compilatation class
null pointer error
null pointer error  Respected sir there is a problem in this code when i add any new record in ms access data base from my code, it gives only null pointer error sir please help me my code are given below compilatation class
Null pointer exception in hibernate - Hibernate
Null pointer exception in hibernate  Hi i am getting null pointer exception.while running the program in hibernate at roseindia.tutorial.hibernate.FirstExample. i copied the total files from roseindia tutorial. the program
C Structure Pointer
C Structure Pointer       This section illustrates you the concept of Structure Pointer in C. You... through structure pointer. For that, we declare the structure type st consisting
Pointer Example
Pointer Example      ... are trying to create a pointer which location is based on the screen touch pointer. The source code for this small example of touch screen application
Pointer in C
About Pointer A pointer is a variable which contain the memory address...; used  when dealing with pointer. 1    &   ... operator 3    ->   structure pointer
how to move pointer in Textfield to newline
how to move pointer in Textfield to newline  consider my case... for a java beginner please send me by mail.   Thank you very much sir... code that can be helpful for a java beginner please send me by mail
null pointer exception cannot be removed
null pointer exception cannot be removed  class list { public...=0; public int q=0; public static int i=0; public arraylist() { int...(int p,int q){ int y=0; for (y=0;y } else arraylist.abcd[p
C Pointer to a function
C Pointer to a function       In this section, you will learn how to use 'Pointer'  function in C. C provides a special feature of  pointer to a function
Getting Null pointer Exception in the jsp page
Getting Null pointer Exception in the jsp page  I have developed this jsp page to store the data in database.While storing the value of check box in database I am getting null pointer exception in the following code
Getting Null pointer Exception in the jsp page
Getting Null pointer Exception in the jsp page  I have developed this jsp page to store the data in database.While storing the value of check box in database I am getting null pointer exception in the following code
Getting Null pointer Exception in the jsp page
Getting Null pointer Exception in the jsp page  I have developed this jsp page to store the data in database.While storing the value of check box in database I am getting null pointer exception in the following code
Getting Null pointer Exception in the jsp page
Getting Null pointer Exception in the jsp page  I have developed this jsp page to store the data in database.While storing the value of check box in database I am getting null pointer exception in the following code
Handle Null Pointer Exception while text file upload
Handle Null Pointer Exception while text file upload  I want the code for handling null pointer exception in jsp page. That is I need an error page for null pointer exception. The cause for null pointer exception is while
Null pointer exception error in Jsp - JSP-Servlet
Null pointer exception error in Jsp  Hi i write a login page. when i validate the login value then the nullpointer exception error is occured. my..." attributes in the input tag So id,userpwd gives null pointer exception
Null pointer exception error in Jsp - JSP-Servlet
Null pointer exception error in Jsp  Expert:Majid Hi i write a login page. when i validate the login value then the nullpointer exception error..." attributes in the input tag So id,userpwd gives null pointer exception. Thanks

Ads