asList() returns a wrapper object for the array which uses the array internally. In contrast, toArray() always creates a new array.
Originally posted by Lucky J Verma:
I cant understand why aslist() shows modificatinos ,wht toArray() cannot
There is no mystery about the exception. Just follow the explanation from Al Mamun and add the following:
Originally posted by Mohammed shareef:
if we increase length of Anonymous array to 5 it is giving ArrayIndexOutOfBound Exception .Let's wait &see who willl solve this mystery.
No. The compiler only looks at the type of the reference variable. The subclass is of no interest at this point.
Originally posted by sandeep atluri:
so it checks if the method is present in both the classes. which is true. and it comes to the conclusion that there is an overloaded version in the subclass.
Since the compiler makes a copy of the reference variable before the finally block is executed.
Originally posted by Gaurav Bhatia:
I am setting the String reference to point to a new value. Then why is it returning the old value.
For me, the following produces the race condition.With synchronisation I get the expected result of 200000. Without I get something between 150000 and 180000.
Originally posted by Burkhard Hassel:
If anyone has a running demo that shows that any i++ cause a race condition, I would be curios to see it.
In this sample there is no object eligible for garbage collection. The code uses only string literals, and the objects for those are created at class loading time.
Originally posted by Sachin Kapoor:
String newName = "Nick";
newName = "Jason";
name = "Frieda";
String newestName = name;
name = null;
No. In this sample there is only one object eligible for garbage collection. For details have a look here.
Originally posted by Ansar Shah:
3 C is correct. Only one CardBoard object (c1) is eligible, but it has an associated Short
wrapper object that is also eligible.
A, B, D, E, and F are incorrect based on the above. (Objective 7.4)