J2EE Technical Programming Interview Questions Part 2
Question 1.) What’s the difference between Thread and Runnable?
Ans: A Java Thread controls the main path of execution in an application. When you invoke the Java Virtual Machine with the java command, it creates an implicit thread in which to execute the main method. The Thread class provides a mechanism for the first thread to start-up other threads to run in parallel with it.
The Runnable interface defines a type of class that can be run by a thread. The only method it requires is run, which makes the interface very easy to fulfil by extending existing classes. A Runnable class may have custom constructors and any number of other methods for configuration and manipulation.
Question 2.) What’s the difference between notify () and notifyAll ()?
Ans: The notify () is used to unblock one waiting thread; notifyAll () is used to unblock all of them. Using notify () is preferable when only one blocked thread can benefit from the change.notifyAll() is necessary to multiple threads should resume .
Question 3.) The Native API driver:
- Translates JDBC calls into a database-independent network protocol that is sent to a middleware server.
- Provides JDBC access to databases through ODBC drivers.
- Converts JDBC commands into DBMS-specific native calls.
- Communicates directly with the vendor’s database.
Question 4.) Which of the following can be the primary key in the entity bean?
- The primary key can be a java primitive type.
- The primary key can be Primitive wrapper classes.
- None of the above.
Question 5.) What are transaction isolation levels in EJB?
- Both A and B.
- All the three.
Question 6.) What are the contents of web module?
Ans: A web module contain:
- JSP files
- Java classes
- gif and html files and
- web component deployment descriptors
Question 7.) What are the various types of Beans ?
Ans: The various types of beans are
- Session Bean
- Entity Bean
- Message Driven Bean
Question 8.) What are the services provided by a container?
Ans : The Various services provided by container are as follows:
- Transaction management for the bean
- Security for the bean
- Persistence of the bean
- Remote access to the bean
- Lifecycle management of the bean
- Database-connection pooling
- Instance pooling for the bean