2014 Latest Oracle 1Z0-895 Exam Dump Free Download!

QUESTION 1
You are writing a client that sends a message to a JMS queue.
What two statements are true?

A.    You cannot use resource injection to access a JMS destination from a Java EE application client.
B.    You can use resource injection to access a JMS destination from a servlet.
C.    You must use a JNDI lookup to access a JMS destination from a standalone Java class.
D.    You cannot use a JNDI lookup to access a JMS destination from a session bean.

Answer: BC
Explanation:
B:In addition to injecting a connection factory resource into a client program, you usually inject a destination resource. Unlike connection factories, destinations are specific to one domain or the other.
Note:
*A destination is the object a client uses to specify the target of messages it produces and the source of messages it consumes. In the PTP messaging domain, destinations are called queues. In the pub/sub messaging domain, destinations are called topics.
* In addition to looking up a connection factory in a client program, you usually look up a destination. Unlike connection factories, destinations are specific to one domain or the other. To create an application that allows you to use the same code for both topics and queues, you castand assign the destination to a Destination object. To preserve the semantics of queues and topics, however, you cast and assign the object to a destination of the appropriate type. For example, the following line of code performs a JNDI lookup of the previously created topic jms/MyTopic and casts and assigns it to a Destination object:
Destination myDest = (Destination) ctx.lookup(“jms/MyTopic”); The following line of code looks up a queue named jms/MyQueue and casts and assigns it to a Queue object:
Queue myQueue = (Queue) ctx.lookup(“jms/MyQueue”);

Read more