This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Micro Frontends in Action and have Michael Geers on-line!
See this thread for details.
Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Pointers

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do we have any concept of pointers in java?
 
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Bartender
Posts: 1840
Eclipse IDE Ruby Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I think she's lovely. It's this tiny ad that called her crazy:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic