Java interview questions: – Various 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.

Regards,

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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s