Graeme Jenkinson

Greenhorn
+ Follow
since Sep 08, 2008
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 Graeme Jenkinson

Only a stateless session bean may provide a web service client view



ejb-3_0-fr-spec-ejbcore.pdf, p40
Having read O'Reilly cover to cover my impression is that - basically - the whole book is relevent. There are certainly topics after Chapter 14 that are on the exam and are important not least Chapter 16 Transactions, therefore, I'd carry on reading.

Graeme
As I see it...

As an MDB does not have a local or remote business interface there are not methods for a client to invoke. So transaction attributes that depend on the state of the client (within or outside a transaction) are irrelevent. For example, it doesn't make sense to define that a client must never be within a transaction (Never) because it can't invoke a method on the MDB anyway!

thanks,

Graeme
Hi,

I would answer C and D. I think C is correct because my understanding is that if a sesssion bean implements a single interface then it defaults to Local whereas if a session bean implements two (or more) interfaces there must be explicitly annotated or defined in the deployment descriptor. I think D is correct beacuse I can't see any issue with a seesion bean implementing both Local and Remote interfaces (I'm sure that the O'Reilly EJB 3.0 gives an example of this in Chapter 11).

I'll take a look at the spec to see whether my understanding is correct. Meanwhile if anybody knows for sure I'd be interested in the answer and the reasoning.

thanks,

Graeme
Hi,

I have a small confusion surrounding the following question from the JavaBeat SCBCD 5.0 Mock Exam:


7) Imagine that the Application you develop periodically sends some events to some other parts of the Application at some defined intervals. Which of the following enterprise bean(s) can be used in this scenario?

1. Entity Bean
2. Stateful Session Bean
3. Stateless Session Bean
4. Message Driven Bean
5. Timer Bean
6. None of the above.



From memory I felt that 1, 3, and 4 were correct, however, the stated answer is that only 3 and 4 are correct. Firstly, I am right is interpretting this question as looking for the understanding of where a Timer can be created? If so, I think that answer is wrong. Trawling my memory banks I clearly remembered a statement in O'Reilly EJB 3.0 book that stated Entity Beans can create timers. After a quick scan I found the following (p48):


Timers can be set on entity, stateless session, and message beans.



To further inestigate this I looked at the EJB 3.0 spec which clearly states that a EJB 3.0 Entity can not create a Timer whereas a EJB 2.x Entity Bean can.

Am I right in thinking that the correct use of the term Entity Bean is to refer to a EJB 2.x Entity Bean (managed by the container and thus able to create a Timer) and that the term Entity refers to a EJB 3.0 Entity (not managed by the container and thus unable to create a Timer)? If so then am I right is saying that answer to the JavaBeat question is wrong? (I'm fairly new to EJB 3.0 and the exam and its objectives so be kind!)

thanks,

Graeme

Originally posted by M Srilatha:
hi,

I think the answer is B for 3rd question.
And the your answers other two are correct as Ankit said!

As the class Two is using a public getter method to get instance variable of class One, those two are not tightly coupled. But the value of y(instance variable of class Two) is depending on the value of x(instance variable of class One), both classes are loosely coupled!

Hope this helps!



I'd be inclined to agree that the answer is B. Although class Two has a dependency (a coupling) with class One. The nature if the dependency is transient; as the dependency is only valid whilst the method setY is executing. This is a more limited dependency that a fixed association through a member instance, therefore, I'd be inclined to say that the coupling is loose (looser).

However, the exam is pretty confused around these issues and despie having a fairly good academic handle on OO concepts (and some good practical experience) I only score 50% in this topic on the real exam!

thanks,

Graeme
Although the statment new long[4] creates an array of primitives of type long, the array itself is an object. This array object is being upcast to the type Object.

Hope that makes sense to you.

thanks,

Graeme
My experience of the was that Devaka's diagnostic exam was that it was pointlessly difficult. I took the diagnostic exam in the final week of my preparation and scored 43% (with the caveat that I only took about 40mins to an hour to complete the exam's questions). I was obviously concerned (as are you).

I then decided to download the bonus MasterExam and take as much time as I needed to help build my confidence (I took the MasterExam on the Saturday before the real exam which was scheduled for Monday). I scored 64% and felt a little happier if still a bit aprehensive.

I took the exam on the Monday and scored 80%. Whilst I was happy enough with the result (as I hadn't commited loads of time to revising and preparing) I felt that I could easily have scored 5 to 10% more if I'd have taken some more time.

In conclusion, I personally found Devaka's exam lab unhelpful as it was not representative of the difficulty of real exam's questions. The MasteExams are also on average not representative of the questions in the real exam, although some of the exam questions were of a similar difficulty. The differential between scores on the MasterExam and real exam appears to be in the order of 15-20%.

Hope this helps reassure you.
[ November 19, 2008: Message edited by: Graeme Jenkinson ]
You seem to have variables i1, i2 in the equality test, whereas i3 and i4 are used to create the Integer objects. Is this just a typo?
This isn't really a serialization problem it's a failing in your understanding of a fundamental object orientation concept: inheritance (IS-A relationships). You really need to have a solid undersatnding of this concept in order to pass the certification exam. Therefore, I would strongly advise reading/re-reading Chapter 2 in S&B.

As a hint to help you on your way Question a) is asking if B IS-A java.io.serializable [sic], this could be tested by creating an instance of class B and using the instanceof operator.

thanks

Graeme
Just to add my 2 cents.

"valueOf" methods are static factory methods. They provide an alternative mechanism for instatiating objects (they are used in a number of places including the wrapper classes). One of their benefits is that they allow the flexibility to determine whether a new instance is created or whether a reference to a previously created instance (from a previosly allocated pool) is returned (this is being an implementation of the Flyweight pattern). In this example the boolean Wrapper class (Boolean) can return the same reference when invoked with Boolean.value("true") without the need to actually create an new object each time. Depending on the exact nature of the program this can potentially add up to a very singificant saving in memory. It is certainly a value tool to understand and apply prudently when your putting Java to work (for more info see Effective Java).

(P.S. I found that understanding the context helped me to remember what valueOf methods took as parameters and what types they returned)

thanks,

Graeme

Originally posted by Rekha Srinath:
Ankit,

I had another query seeing the following code of yours:



Can i say that the above code ENSURES that c1 WILL complete first and then followed by c2?

[ November 03, 2008: Message edited by: Rekha Srinath ]



I've only skimmed the thread so I may be wrong, but no you can't say anyhting about whether c1 or c2 completes first or last; this is solely in the hands of the scheduler.
It seems that this may not be a straighforward as I thought. Typing "java generics array" into your favoured search engine brings up a lot of links all of which suggest that (at least in Java 5) there is a problem in creating typesafe arrays using generics (I haven't had time to look at this properly but it appears to be a consequence of the type erasure at runtime). Perhaps some other ranchers could spread some light on the subject?

(Given the issues I can only assume that this isn't really in scope for SCJP )
[ October 29, 2008: Message edited by: Graeme Jenkinson ]

Originally posted by Preetha Arun:
It is not type safe on right hand side(new Aks[5]). it means your are allowed to put anything in the array.

Please correct me if am wrong.

Preparing Scjp1.5



That's is essentially my understanding. The Langauge Specification states (http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#108850):

"If no bound is given for a type variable, Object is assumed. "

thanks,

Graeme
http://java.sun.com/javase/6/docs/api/


public String[] split(String regex)

This method works as if by invoking the two-argument split method with the given expression and a limit argument of zero.




public String[] split(String regex,
int limit)
...
The limit parameter controls the number of times the pattern is applied and therefore affects the length of the resulting array. If the limit n is greater than zero then the pattern will be applied at most n - 1 times, the array's length will be no greater than n, and the array's last entry will contain all input beyond the last matched delimiter. If n is non-positive then the pattern will be applied as many times as possible and the array can have any length. If n is zero then the pattern will be applied as many times as possible, the array can have any length, and trailing empty strings will be discarded.



Thus the trailing empty Strings are not returned. COmpare for running with .split("\\w", -1).
[ October 23, 2008: Message edited by: Graeme Jenkinson ]