aspose file tools*
The moose likes Beginning Java and the fly likes Pointers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Pointers" Watch "Pointers" New topic
Author

Pointers

deepthi k
Greenhorn

Joined: Dec 16, 2005
Posts: 6
Do we have any concept of pointers in java?
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
Define "pointer".

I've searched the JLS and the most specific use of the word "pointer" occurs in 4.3.1 (Objects):



An object is a class instance or an array.

The reference values (often just references) are pointers to these objects, and a special null reference, which refers to no object.



Note this doesn't imply that you can do C-style pointer arithmetic in Java:

Hey, remember that old t-shirt of yours with that code emblazoned across the chest?
[ December 20, 2005: Message edited by: Jeff Albrechtsen ]

There is no emoticon for what I am feeling!
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13869
    
  10

The Java language does not have pointers in the same way as you have them in C or C++ - i.e., pointers that can point to any location in memory and that you can do pointer arithmetic with.

However, Java does have references, which are essentially the same as pointers , but with a few restrictions meant to make programming and debugging safer and easier. For example, a reference must always point to a valid object or null - it can't point to any arbitrary location in memory, and you can't do tricky arithmetic with it.

Note that Java has the NullPointerException - it should have been called NullReferenceException, but now it's far too late to change the name...


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1815
deepthi,
welcome to JavaRanch! We're a friendly bunch here, but we do have one rule that we take seriously -- the JavaRanch Naming Policy

Basically we require display names to be two words: your first name, a space, then your last name. While we prefer you use your real name, we of corse cannot enforce it. However, obviously fictitious names are not allowed.

Please edit your profile and correct your display name.


Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Pointers
 
Similar Threads
tomcat and jndi resource
lambda probe shows unproportial number of sesssions
java
Pointers in Java
How to disable back button of browser after session invalidation?