Results 1 to 3 of 3

Thread: Creating aliases [RESOLVED]

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2003
    Posts
    1,004

    Creating aliases [RESOLVED]

    Can you create an alias in Java. If so, how?
    Last edited by Darkwraith; Aug 9th, 2004 at 07:30 AM.
    "Can't" and "shouldn't" are two totally separate things.

    All questions should be answered. All answers should be true. That is why I post.

  2. #2
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    Yes. Since all an alias is, is a reference that denotes the same object as another reference.
    Code:
     X x = new X(); 
     Y y = new Y(); 
    
     boolean alias = x == y; // false 
     x = y; 
    
     boolean aliases =  x == y // true, denote the same object

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2003
    Posts
    1,004
    Thank you.
    "Can't" and "shouldn't" are two totally separate things.

    All questions should be answered. All answers should be true. That is why I post.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width