Michal Adamski

Greenhorn
+ Follow
since May 30, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Michal Adamski

And how is with collections?
Integer[] array = new Integer[2];
array[0] = 4;
array = null;

What happens with object on which pointed first element of array (array[0]). Is it eligible to GC? If I set refer array to null are the all elements of array are set to null as well?
So my question is, wheter is eligible or not and why.
Thanks very much for help!
Michał
class A {};

class Test {

A a = (A)(Appendable)this; // OK (or any interface insted of Appendable)
A a = (A)this // Compilation fails
A a = (A)(String)this // Compilation fails
}

Could you explain in more details why is it like this?
Why compiler allows cast classes for any interface?