[java] Reasons to make games in java?

Started by
20 comments, last by ARCHIGAMER 23 years, 11 months ago
The reference in Java IS NOT a POINTER. It is a reference. The difference is that with pointers you have pointer arithmetics and are thus dealing with raw memory. This of course has it''s ups (you can do some speedy and cool tricks with it) and downs (in a huge application one cool trick going bad will crash the whole thing and it''ll be hard to trace without proper [=expensive] tools). In Java the references don''t deal with raw memory locations as such, you can''t e.g. use the pointer to a String to go through the letters in the String. You have to use the class that the reference points to in order to achieve that. It is a bit slower and a lot safer way.
-Pasi Keranen
Advertisement
Hehe depends on implementation...
as taken from the Java faq
"No, no, a thousand times no. Java does not have pointers, no way, no how, the daily email I get from people who think differently not withstanding.
Java does have references. A reference is an abstract identifier for an object. It is not a pointer. A reference tags a particular object with a name in the Java virtual machine so that the programmer may refer to it. How exactly the virtual machine implements references at the level of machine code is VM-dependent and completely hidden from the programmer in any case. Most VMs including Sun''s use handles, not pointers. A handle is a pointer to a pointer. At the level of machine code in the CPU a reference is an address in memory where the address of the object is stored. This way the objects can be moved around in memory and only the master pointer needs to be updated rather than all references to the object. This is completely hidden from the Java programmer, though. Only the implementer of the virtual machine needs to worry about it. Indeed, this is not the only way references can be implemented. Microsoft''s VM actually does use pointers rather than handles. Other schemes are possible. "

In my original post I stated that Java has pointers with no pointer math. I stand by that because other than pointer math there is NO difference. Guess it is just my way of thinking about it but
A pointer to a pointer is still a pointer no? And MS Java flat out uses pointers which is at least 80% of vms out there =)

This topic is closed to new replies.

Advertisement