Michael Rootman

Greenhorn
+ Follow
since Apr 15, 2009
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 Michael Rootman

Dear all,

Please advise:

I use Metro to generate stubs from online WSDL.
Part of create java classes are those, that should compose SOAP header. Although I cannot see the way how these java classes can be used to automatically create header in outgoing message.


Created classes:

- MyHeader (methods: setTransaction)
- Destination (methods: setType, setId)
etc

Thank you.
13 years ago
Hi,

Do you get any error?
Did you check that port is opened on remote server?

Regards,
Hi All,

Is there a way I can impose J2EE container to initilize regular java class and store it in JNDI automatically?
Intention is to have some class (not EJB), that will be automatically injected later (with @Resource) into other EJB and MDB.

Please advise,
HI,

Now I can understand the logic in the output.

Thank you to everyone for help!

Ulf Dittmer wrote:
The hint is: "2" is a frequently requested value, while "2000" is not.



I am really sorry, but this does not make sense for ma at all. What is it "frequently requested value"? How should I know which one is and which is not?

Explanation in exam itself is not clear for me as well:

When the references i and eye in the pool are compared 2==2 results in true and 2000==2000 is false since it exceeds 127.



How 127 is connected to comparing Integer values?
How JVM proceed boxing and unboxing, so same Integer values are equal or not equal depending on how this values big or "frequently requested"?
Hi, sorry, I cannot say, that Javadoc make it more clear for me:

public static Integer valueOf(int i)

Returns a Integer instance representing the specified int value. If a new Integer instance is not required, this method should generally be used in preference to the constructor Integer(int), as this method is likely to yield significantly better space and time performance by caching frequently requested values.



Appreciate additional explanations.
Q69 from Inquisition exams:



The result is false, true false.

Why 2000==2000 is false ?

Thank you.
Hi Guys,

I get the point. Thank you for explanations.
My next question is such freedom to choose can impose issues?

Let’s take class that implements TestInterface (ClassB) and exception thrown on the doIT method.
Any usage of this method (ClassA) will obligate to catch declared exception, right?
Later I can review my ClassB and decide that I do not want to throw exception. I am allowed to.
What will happened with ClassA(assuming it is not going to be recompiled), that still tries to catch exception that never thrown?

Thank you.
Sorry, but I cannot see how your post answers on my question.

Consider following code:



ClassB implements TestInterface, so I have to implement doIt method. But I do not have to declare that this method throws IOException.
Class A initializes ClassB and I can invoke doIt method without handling exception.
So why should I ever need to declare in interface that doIt method throws exception?
Hi All,

I have interface with abstract method, that throws checked exception and class that implements that interface and method.
Am I obligated to declare that implemented method throws exception mentioned in interface declaration?

As for my test it is not the case.

Then why anybody will declare method with checked exception in interface?

Please clarify.

Thank you.

Hi All,

I am doubt about explanation for following question(Q 27 of Practice exam 2) :

What is the result of:


Correct answer is "Compilation Error", but explanation is "The method parseBoolean(String) is not available in java.lang.Boolean class"

I do have parseBoolean in Boolean class and I think all wrapper classes have .parseXXX. To my opinion the answer "Compilation Error" is correct because parseBoolean returns primitive boolean and getClass method cannot be applied on primitive.

Am I wrong? Please Explain.
Hi All,

Regarding point 1 I found where my mistake is. Instead of javac I used Oracle Java compiler (JDeveloper).
And he is totally fine with such declaration . My code get compiled and executed.
Why is that? Shouldn’t java specifications be obligated to all 3rd party compilers?





Regarding point to 2 I think it is seems a little bit exaggerated to assume such things. In the same way I can assume that before and after presented code we have opening and closing comments, so code will compile and executed. In my case both lines (18 and 19) leads to the same answer, so it is not an problem.

In any case thank you all and especially to Devaka for such great product!


Hi All,

I just did one of Devaka exams and it seems to me that some explanations are not 100% correct. Do you mind to comment:

1.


Answer is that code will not compile because:

Both symbols ... and [] cannot be used together.



While I agree that in order to execute class should exist main(String[] args) method, but it totally fine to have methods with (String... argv[]) . It means that both symbols can be used together.

2.


Answer is that compilation fails because line 19 cause compilation error.
To my opinion even prior line 19(on line 18) we have error, because exception is not handled.

Any comments?

Thank you.
Hi All,

May I ask to explain me following point from FAQ:

Local classes cannot access non-final variables.



Thank you.

Hi,

Ankit Garg wrote:Well your program still doesn't gives the guaranteed behavior of the result you want. Actually you won't get the correct result most of the times. You need to do something more complicated to get reliable output



Thank you for advices. Actually I got main result - I learned how wait() and notify() should be used.