CTS java FAQS
CTS java FAQS
- What is synchronization ?
Synchronization is the ability to control the access of multiple threads to shared resources. Synchronization stops multithreading. With synchronization at a time only one thread will be able to access a shared resource.
- What is the difference between synchronized block and synchronized method ?
Synchronized blocks place locks for the specified block where as synchronized methods place locks for the entire method.
3. What is the difference between yield() and sleep()?
When a object invokes yield() it returns to ready state. But when an object invokes sleep() method enters to not ready state.
- What must be the order of catch blocks when catching more than one exception?
The sub classes must come first. Otherwise it will give a compile time error.
- What is Connection pooling ?
Connection pooling is a technique used for sharing server resources among requesting clients. Connection pooling increases the performance of Web applications by reusing active database connections instead of creating a new connection with every request. Connection pool manager maintains a pool of open database connections.
- How do you handle your own transaction ?
Connection Object has a method called setAutocommit ( boolean flag) . For handling our own transaction we can set the parameter to false and begin your transaction . Finally commit the transaction by calling the commit method
- What is "application component provider" ?
The application component provider is the company or person who creates web components, enterprise beans, applets, or application clients for use in Java EE applications.
- What modifiers may be used with an inner class that is a member of an outer class?
Inner class may be declared as public, protected, private, static, final, or abstract.
- How you will enable front-end validation based on the xml in validation.xml ?
The tag to allow front-end validation based on the xml in validation.xml. For example the code: generates the client side java script for the form \"logonForm\" as defined in the validation.xml file. The when added in the jsp file generates the client site validation script.
- Can we use the constructor, instead of init(), to initialize servlet ?
Yes. But you will not get the servlet specific things from constructor. The original reason for init() was that ancient versions of Java couldn’t dynamically invoke constructors with arguments, so there was no way to give the constructor a ServletConfig. That no longer applies, but servlet containers still will only call your no-arg constructor. So you won’t have access to a ServletConfig or ServletContext.
- What is the difference in using request.getRequestDispatcher() and context.getRequestDispatcher() ?
In request.getRequestDispatcher(path) in order to create it we need to give the relative path of the resource. But in resourcecontext.getRequestDispatcher(path) in order to create it we need to give the absolute path of the resource
- What’s HQL ?
HQL is the query language used in Hibernate which is an extension of SQL. HQL is very efficient, simple and flexible query language to do various type of operations on relational database without writing complex database queries.
- How can we see hibernate generated SQL on console ?
We need to add following in hibernate configuration file to enable viewing SQL on the console for debugging purposes <property name="show_sql" >true</property>
Comments
Post a Comment