Manfred Klug

Ranch Hand
+ Follow
since Jun 04, 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 Manfred Klug

Originally posted by Lucky J Verma:
I cant understand why aslist() shows modificatinos ,wht toArray() cannot

asList() returns a wrapper object for the array which uses the array internally. In contrast, toArray() always creates a new array.
Hi dolly,

hava a look at the errata
The correct definition for process is:
public static <E extends Number> List<E> process(List<E> nums)

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.

There is no mystery about the exception. Just follow the explanation from Al Mamun and add the following:

looping again and retrieving fifth element which is ... or i = ...
set arr[...] = 0;

I think it should be clear why the ArrayIndexOutOfBoundException occurs.

Originally posted by Praveen Seluka:
Think e is exponential

Correct.

what is d?

D or d specifies that this literal is a double value. In contrast, use f or F for float values.
Hi samura,

the problem is the b variable in BinstanceTest. When you instantiate a BinstanceTest, a second BinstanceTest is instantiated to initialize the b variable which instantiates a BinstanceTest to initialize the b variable which ...

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.

No. The compiler only looks at the type of the reference variable. The subclass is of no interest at this point.

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.

Since the compiler makes a copy of the reference variable before the finally block is executed.
Howdy Burkhard,

then I would bet you have a single processor machine. Mine is a dual core processor which makes the problem much more likely to happen.

This are the dark sides with multithreading. You may test a program for several months, and as soon as it runs on another machine, it fails immediately.

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.

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 dhwani mathur:
Does ++b promote byte b to an int?

Have a look at 15.15.1 Prefix Increment Operator ++ in the Java Language Specification

Originally posted by Sachin Kapoor:
String name;
String newName = "Nick";
newName = "Jason";
name = "Frieda";
String newestName = name;
name = null;

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.

For details have a look at Strings, Literally.
Hi,

the problem here is that 'e.printStackTrace()' writes to standard error and ' System.out.println' to standard out. Dependent on the environment (e.g. Eclipse), the output from standard out and error may not be printed in the correct order.
Hi,

the problem here is that 'e.printStackTrace()' writes to standard error and ' System.out.println' to standard out. Dependent on the environment (e.g. Eclipse), the output from standard out and error may not be printed in the correct order.

Originally posted by Ansar Shah:
Answer:
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)

No. In this sample there is only one object eligible for garbage collection. For details have a look here.

Originally posted by Srinivasan thoyyeti:
Do you think wait,notify can be called out-side synchronized context

If you read the text, you will see, that I know that this will not work. It is only for demonstration purposes.