A Question about JAVA

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fassuly
    New Member
    • May 2007
    • 1

    A Question about JAVA

    hi all :) ,
    my question is :
    What was LOST and What was GAIEND in java with not including the pointers in C++?

    and can u give me an example plz

    thanks :)
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by fassuly
    hi all :) ,
    my question is :
    What was LOST and What was GAIEND in java with not including the pointers in C++?

    and can u give me an example plz

    thanks :)
    Java does have pointers (they're called 'references'), it got rid of pointer arithmetic
    though, for reasons of garbage collection mainly; think of this:
    Code:
    T[] ta= new T[54];
    T* pT= &ta[41]; // not possible in Java
    pT++; // not possible in Java
    ta= null;
    Should ta be eligible for garbage collection? What about array bounds checking
    w.r.t. pointer (referernce) pT?

    kind regards,

    Jos

    Comment

    Working...