Prashant Bhardwaj

+ Follow
since Jul 25, 2006
Merit badge: grant badges
For More
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 Prashant Bhardwaj

Hi ,
After having cleared the SCJP 5.0 exam, I'd like to know if I need to apply seperately to get the Certificate, logo and business card(the one that has sun certified programer written on it) , or does Sun send it by default ?
16 years ago
no replies yet..:-(.

One more question : Do I need to apply seperately for getting the
Certificate, logo and business card(the one that has sun certified programmer written on it) , or does Sun send it by default ?
16 years ago
I Passed SCJP(310-055) today!
I would like to thank Kathy and Bert for their wonderful book.Bio Deisel rocks for sure !
My score is not that great (72%), but I am seemed so tough!
Having said that, one advice for wannabe's :
Code , code and code !. that's it.
KS&BB book is great, but you can not hope to clear this exam unless you
code extensively and try out the questions given in the book and mock exams.
More importantly, practice by changing the given code and then seeing the output.

One question to more experienced people, specially Kathy and Bert :
At the beginning of the exam, there is a survey conducted, that asks for the candidate's level of expertise in various topics.
Does the difficulty level of the exam change as per that?
I wonder whether that made the exam tough for me, because I selected excellent and intermediate rank for everything in the survey.

thanks again to Kathy and Bert
16 years ago
I am sure Kathy and Bert would love to kill me for posting so many code excerpts from their book.:-(.Sorry, I am a confused soul.

The below code will obviously fail compilation because of the
error at line 16:

No problems till here.

However, the explanation given in the Reference/Hint section(that comes with the questions in mock exam)is :

...If line 16 was removed, the code will compile and the correct answer would be "Start Hello World File Not Found".

When I tried compiling this code after removing line 16,the code still did not compile and gave :

Please confirm whether there is a wrong explanation given in KS&BB,
or if there is a gap in my understanding.
what I am saying buddy, is that if you take the reading serialized part out of the given code, and put it into a seperate file, you'l see that the incremented value of static z is not retained :

Compile and run this. You'l get a 0 9 output.
Note: This code assumes that has been compiled and run already, and an instance of SpecialSerial has been serialized to the file named "myFile".

But anyways, thanks for your attempt to cheer me up.
Can't help being discouraged at times... the questions are sneaky.
but then I recover and restart. :-)
thanks for your reply.
I took the reading/ObjectInputStream part out of the given code and put it in a seperate file
Upon compiling and subsequent runing TestSer2,the value I got is 10 0 9.
So, it means that in the 1st case (, because SpecialSerial was still available in memory, Specialserial.z++ value was retained.
Not if we invoked it seperately.

Phew !, its so easy to overlook the details.
I'm beginning to feel nervous.
Somebody pls provide any tips to prepare for this exam!.
In chapter 6 --> Serialization, I came to learn that Static variables' are not saved as part of Object's state.Serialization Is Not for Statics.
Yet in the question no. 15 (last question) of the excercise :

The answer is 10 0 10.

My question is why did s2.z = 10 when it should've actually not retained the value incremented by s (going by the literature)?
I know that there is a gap in my understanding...please educate me.
Thank you Naom and Priyam !.
I did not know that var-args accepts no arguments as well.
This was a googly!.
This is a question to Kathy/Bert or any other person who might have read SCJP 5.0 book by Kathy and Bert.

On page number 129/130-->chapter 2-->Object Orientation-->Determine whether a Default Constructor will be created, it is written that in case there exists a constructor with arguments, then one can't have a no-arg constructor unless one types it in him/her self.

However, there is a mock exam quiz that looks like:
public class Numbers..., negate, TreeSet etc. (sorry. can't quote the exact question because of copyright issues.The code is basically about negating the numbers added to a TreeSet.).
There is no no-argument constructor typed, yet the following line of code:

compiles and runs fine.

I am confused why it is working, when it shouldn't have going by what is written in page numbers 129/130 of chapter 2.

Can you please reply as soon as possible ? my exam date is near.
thanks in anticipation,
It seems that WL 8.1, SP2 does not support classloading over the network
when i try to make an anonymous call to a remote ejb interface using reflection. I have attached an example you can test with, just change the look method parameter to any remote interface on your server. When i
use the same code within my deployed application (*.ear) i get
Exceptions. On v8.1 SP2 i get ClassCastException (shown in code)

When i use the code inside my application in weblogic i want to access
another Application (ear) remote interface without knowning its interfaces
through jar/class files in my application...

Do any of you have experience with this way of accessing ejb inside an
application in weblogic?
Weblogic say there server is designed in such a way, and the only way out is to use a custom class loader.

Cheers Prashant
17 years ago
I am new to webservices, so excuse me if you find the question absurd.
I have a Session EJB, (weblogic 8.1) whose methods I want to expose as webservice.These methods have arguments and return types that are not
built-in datatypes.
If I use servicegen ant task, it creates some client jar file.
Question: Is it that I've to put these class files(jar) in the calling application? Is there no way that I can avoid that?
In other words, is it possible to use webservices w/o any client jars at all?

17 years ago
Given java 1.4 enviornment.
The run method, as we know has a void return type.
I have a situation where I want to spawn multiple threads, all of them making
calls to methods in different EJBs.
The EJB calls return the same type of Object though.
So, if I put the calls in run method , how do I make this returned Object accessible to the calling API ?
Sorry, if you find it a stupid question.
ok, I had to go through the embarassment of our mutual idea being rejected by my Technical Manager, but found the answer anyway from him. :-|

Putting ejb-client jars from application A into another Application B is bad because then you have to update the client jars in B every time you change application A.It also means that you are making cross-references between application codes.

The best way out of it is (he told me 2 more, but they went over the head, besides, he told me this one is the best ) :
"Use EJB reflection". Its more costly than any other solution, but its the cleanest way for the said purpose.
sorry. Read "remote server" as remote interface in my statement above.
And also by client jars, I mean the Remote interface(stub) class files.
ok, my bad for not having described the enviornment completely.
Ours is a distributed enviornment and we have 2 application servers administered by a managed server (weblogic 8.2).
Take it for granted that the applications are on different JVMs.
Now, if I want to use the EJB in application 'A' from another application 'B' by using the remote server, then the only way I know to do that is by putting the client jars of 'A' in server classpath so that 'B' can have access to them at runtime.
However, doing that would make hot deployments difficult, besides its not a good practice to keep such jar files in server classpath.
Phew!, does that explain the problem in its entirity?