Win a copy of Rust Web Development this week in the Other Languages forum!

sherin stephen

+ Follow
since May 14, 2006
sherin likes ...
IntelliJ IDE Java Ubuntu
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by sherin stephen

i think you are trying to run it with
> java test1
which is the name of your source file.

> java C
is the correct usage here , because there is no "class" like test1. its just the source file name.
this is a sample code for PriorityQueue implementation.
"An unbounded priority queue based on a priority heap. The elements of the priority queue are ordered according to their natural ordering, or by a Comparator provided at queue construction time, depending on which constructor is used. A priority queue does not permit null elements. A priority queue relying on natural ordering also does not permit insertion of non-comparable objects (doing so may result in ClassCastException)"

pq.offer(E e) inserts the element
pq.peek() gives the last inserted element
pq.poll() takes out the last inserted element
pq.size() gives you the number of elements in the queue.

as simple as that ....

the program initially puts the array elements into the queue (in the natural order)and the prints it

the next constructor gives in a comparator to define the ordering (reverse in this case).
i dont think tht the statement causes 2 objects to be created .
as far as i know , a string object is created in the heap and reference given to the variable . the reason why no literal pool is involved is the presence of 'new' .

any other sugestions ?
the reason behind the term 'reenterant' the same phenomenon . however the lock hold count is inceremented each time the same lock is acquied .
hope i'm not wrong

Originally posted by Naseem Khan:

A, E are true. B, C and D false.



how could A be true
i dont think of that is possible straight away because you are invoking a batch process that is beyond the controll of your program