JavaSpartans
Java J2ee Struts Hibernate Spring Interview Questions Java J2ee Struts Hibernate Spring Interview Questions
1138 Results; Time:0.291 Sec; Page : 1 ; Results From 1 to 10. Results Per Page

1. What are the differences between sleep() and wait() methods in multi threading ?

  1. sleep() method is defined in class Thread and wait() method is in class Object.
  2. sleep() is a static method where as wait() is an instance method.
  3. sleep(1000) will wait exactly for 1 second wait(1000) wait up-to 1 second.
  4. sleep() object will keeps its locks. wait() object releases all its locks.
  5. wait(), notify(), notifyAll() methods should be called only from with in synchronized context or code.
  6. A thread could stop waiting earlier if it receives the notify() or notifyAll() call.

2. Can you tell the other names for Marker Interface ?

Tagged Interface , Ability Interface , Null Interface , Empty Interface, Blank Interface as it does not contain any fields or methods.

3. Can you give few examples for Marker Interfaces ?

java.io.Serializable ,
javax.servlet.SingleThreadModel ,
java.rmi.Remote,
javax.ejb.EnterpriseBean,
java.lang.Cloneable,
java.util.EventListener.

4. What is a Socket ?

In 1970 , Developed by the Berkeley University for C & UNIX to write network applications . Our java.net.* package internally uses sockets and it abstracts some implementation .

5. What is a self-executable jar ?

A jar which can be executed by it-self as an application by just clicking on that .

6. How can you create a self executable jar ?

Self executable jar is one which can be executed directly just by clicking on that with mouse like a .exe file in C Language.
By providing main class which contains the main() method, the starting point of application in the manifest file of the jar.

7. How do you implement synchronization ?

Synchronization is a process of restricting concurrent access to the shared resources. As synchronization is a performance issue, we should be very much careful fo decide at which part of the code the problem may occur. At that place provide a synchronized block or simply provide a synchronized method. just use the key word synchronized before the method or block. Please note that we can synchronize only blocks or methods. we can not synchronize variables or classes. By creating locks automatically by using wait(), notify() and notifyAll() methods  the Java Virtual machine taking care of inner implementation.

8. Synchronization will be done on what ?

We can synchronize only methods and blocks using the keyword 'synchronized'.
like
synchronized method m1(){
}
or
synchronized{
}

9. If all the threads in a Servlet are hanged. How do you come-out or debug from this situation ?

By Monitor thread .

10. Consider 2 tables 8th standard students and 9th standard students. Can you write a query to find the students having the same name in both classes ?

Select 8.name from 8,9 where 8.name == 9.name

Java J2ee Struts Hibernate Spring Interview Questions
1138 Results; Time:0.291 Sec; Page : 1 ; Results From 1 to 10. Results Per Page
Menu - javaspartans.com - Java J2ee Struts Spring Hibernate Interview Questions
Hostens.com - A home for your website
Ads By Google