Subscribe

RSS Feed (xml)

Powered By

Skin Design:
Free Blogger Skins

Powered by Blogger

search topic

Tuesday, May 13, 2008

Java Interview Questions-4

Question: How to create multithread in a program?
Answer:
You have two ways to do so. First, making your class "extends" Thread class. Second, making your class "implements" Run able interface. Put jobs in a run() method and call start() method to start the thread.

Question: Can Java object be locked down for exclusive use by a given thread?
Answer:
Yes. You can lock an object by putting it in a "synchronized" block. The locked object is inaccessible to any thread other than the one that explicitly claimed it

Question: Can each Java object keep track of all the threads that want to exclusively access to it?
Answer:
Yes

Question: What state does a thread enter when it terminates its processing?
Answer:
When a thread terminates its processing, it enters the dead state.

Question: What invokes a thread's run() method?
Answer:
After a thread is started, via its start() method of the Thread class, the JVM invokes the thread's run() method when the thread is initially executed.

Question: What is the purpose of the wait(), notify(), and notifyAll() methods?
Answer:
The wait(),notify(), and notifyAll() methods are used to provide an efficient way for threads to communicate each other.

Question: What are the high-level thread states?
Answer:
The high-level thread states are ready, running, waiting, and dead.

Question: What is the Collections API?
Answer:
The Collections API is a set of classes and interfaces that support operations on collections of objects.

Question: What is the List interface?
Answer:
The List interface provides support for ordered collections of objects.

Question: How does Java handle integer overflows and underflows?
Answer:
It uses those low order bytes of the result that can fit into the size of the type allowed by the operation.



Note: Above interview questions are same if your are looking for Java Interview Questions, Java Interview Question, Java J2ee Job Interview Companion, Java J2ee Interview Questions, Java Interview Questions And Answers, Interview Questions On Java,, Java Job Interview Questions, Java Interview Tips, Java Questions or Java Faq

No comments: