Finner Jones

Ranch Hand
+ Follow
since Jun 12, 2006
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 Finner Jones

Hi Poonam,
The exam objectives are described here:

http://www.sun.com/training/catalog/courses/CX-310-084.xml

Good Luck
Finner
Hi,

I have a servlet which overrides doHead() and doGet().
I have a JSP with a form action to call the servlet, the form method="HEAD" and a submit button.
However, the doGet() gets called instead of the doHead() in the servlet.
I have read that a HEAD is a GET but I was expecting the request to pass through doHead() first and then doGet().
When will the doHead() method be called in a servlet?


Thanks in advance
Finner

Hi Gowher,

Originally posted by gowher amin naik:
[CODE]
But in java finally block always executes whether exception is thrown
or not.



In your code example the Exception is occurring inside the finally block. The Exception is not caught and goes up to main and then the program exits. So the program never gets to finish the finally block. If you call m() from inside the first try block (comment the second m() ) you will see finally being printed and an exception thrown (because there is no catch clause).
I hope this helps.

Finner
Hi,


http://www.danchisholm.net/july21/mybook/index.html

Finner
Hi,
The general opinion is to do as many mock questions as you can and compile and run small programs to check your understanding.

I have just found this web page. It has lots of links and resources.
http://dmoz.org/Computers/Programming/Languages/Java/Resources/Certification/

Good luck !!
Finner
Hi Naseem,
Your fine diagram looks correct to me

Finner
Hi,
My understanding of synchronized and thread safe is that any code which is synchronized can only be executed by one thread at a time and thread safe is when no two threads access the same data at the same time.
In the case of a Vector you use methods such as

elementAt()
firstElement()
lastElement()
get()
set()

to access a manipulate the data. These methods are synchronized so there can only ever be one thread inside at a time.

Have a look at this

http://java.sun.com/docs/books/tutorial/essential/threads/monitors.html

This quote is from the same page.

"Whenever control enters a synchronized method, the thread that called the method locks the object whose method has been called. Other threads cannot call a synchronized method on the same object until the object is unlocked. "

I'm not sure if that answers your question

Finner
Hi,
Vector and Hashtable are already synchronized. They are the only two implementations in the Java Collection that are synchronized. If you are going to use anything else you would need to synchronize the code to make it thread safe.

Finner
Apologies accepted




The ammended code will have compile error "Duplicate method main in A".


I think it should give error saying that "main is already defined"


You are correct


But I am not getting how this is the correct answer in K&B mock??


I don't understand what you are asking here ?


Finner


Hi,
You are implementing the main() method in the interface and returning a String on a void return type ..... ?


Finner

[ July 05, 2006: Message edited by: Finner Jones ]
[ July 05, 2006: Message edited by: Finner Jones ]
HI,
I agree with Andy.
3 objects are created and variable assignment does not create a new object. Concatenation using + on String objects, however, does.

The original program





Finner
Hi Morten,
Yes you're right !!! Oops !




Thanks
Finner
Hi,
Let's have a peek at what's happening
By the time we get to this line:


A and B will reference 2 different objects.
The compiler will see something like:

"123123" = "123" + "123";

And the resulting string, "123123", is a newly createed string object that C will reference.


Finner.
Hi Alberto,
The golden rule with strings is that they are immutable, they cannot be changed. So in your example the following will happen.

The "123" creates a string literal - 1 object
The new String() creates a String object - 2 objects
C = A + B creates a new String object because strings are immutable - 3 objects.

Finner
[ July 05, 2006: Message edited by: Finner Jones ]