Can you create an alias in Java. If so, how?
Printable View
Can you create an alias in Java. If so, how?
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
Thank you. :)