Saturday, 12 November 2011

Java interview questions: - What are the functions present in Queue interface?

This is one of the typically asked  Java interview questions in most of the Java interview.
  • public boolean offer(Object element): return false if the object cannot be added to the collection due to size issue and without throwing unchecked exception.
  • public Object remove(): behaves like the Collection interface version.
  • public Object poll(): behaves just like remove() but when invoked on empty collection returns null without throwing exception.
  • public Object element(): for querying the element at the head of the queue. Throws exception when a collection is empty.
  • public Object peek(): for querying the element at the head of the queue. Returns null if the collection is empty.
Also see Batch Processing video in Hibernate of  Java interview questions

Visit for more  Java/J2EE interview questions series.


Also visit author’s blog for more Java/J2EE interview questions

1 comment: