Thursday, 15 December 2011

Java interview questions: - In hibernate framework explain the core interfaces of it?

This is one of the most favorite  Java interview questions of the interviewer. So in the following way one can answer this question: -

Session Interface
This is the primary interface used by hibernate applications
The instances of this interface are lightweight and are inexpensive to create and destroy
Hibernate sessions are not thread safe

Session Factory Interface
This is a factory that delivers the session objects to hibernate application.

Configuration Interface
This interface is used to configure and bootstrap hibernate.
The instance of this interface is used by the application in order to specify the location of hbm documents

Transaction Interface
This interface abstracts the code from any kind of transaction implementations such as JDBC transaction, JTA transaction

Query and Criteria Interface
This interface allows the user to perform queries and also control the flow of the query execution

Following is the video where it is shown practically to implement Many To One relation in database using Hibernate: -



Click and get to see more on  Java/J2EE interview questions series.

Regards,

Also visit author’s blog for more Java/J2EE interview questions

Thursday, 8 December 2011

Java/Struts interview questions: - Elaborate the difference between Struts 1.x and Struts 2.x

Struts 1.xStruts 2.x
Configuration of ActionServlet via servletConfiguration of FilterDispatcher is via filters
Struts1 extends the abstract base class
by its action class
Implements Action interface but not a compulsion.
 Any POJO class can behave like Action
Follows FrontController patternFollows FilterDispacther pattern
Extra care has to be taken to make resources
 thread safe because Actions are singletons
Action objects are instantiated for each request and
 hence are inherently thread safe
Testing is a problem since execute() method
exposes Servlet API
Testing is easier
ActionForms serves are inputAny POJO can serve as input
Binds objects in page using standard mechanismBinds objects using valuestack
Type conversions are using common-beanutils.jarType conversions are using OGNL
General notation for config file is Struts-config.xml
 is used
General notation for config file is struts.xml
No concept of namespaceNamespace are readily available for modularity

Also see the following interesting video on Struts: -



Know more on  Java/Struts interview questions

Regards,

Get more on Java/Struts interview questions from author’s blog

Saturday, 26 November 2011

Java/Struts interview questions: - All types of Action classes in Struts.

One of the most likely questions asked in  Java/Struts interview questions. So set your answers accordingly as mentioned below.
  • ForwardAction: to do the “forward-only” and allow you to access the specified JSP page directly without going through controller.
  • IncludeAction: IncludeAction is much like ForwardAction except that the resulting resource is included in the HTTP response instead of being forwarded to
  • DispatchAction: provides a mechanism for grouping a set of related functions into a single action, thus eliminating the need to create separate actions for each functions.
  • LookupDispatchAction: provides a mechanism for grouping a set of related functions into a single action.
  • SwitchAction: This is a standard Action that switches to a new module and then forwards control to a URI within the new module.
  • DownloadAction: This is an abstract base class that minimizes the amount of special coding that needs to be written to download a file.
  • LocaleAction: Implementation of Action that changes the user's Locale and forwards to a page, based on request level parameters that are set.
  • EventDispatchAction: An Action that dispatches to to one of the public methods that are named in the parameter attribute of the corresponding ActionMapping and matches a submission parameter.
  • MappingDispatchAction: Same with Dispatch Action, group similar functionality into a single action class but with different mechanism.
  • DynoAction: Allow you to create a virtual form bean declaratively to increase the development speed.
View the following video on understanding the basics introduction to Struts: -



Click and get to see more on Java/Struts interview questions series.

Regards,

Also visit author’s blog for more Java/Struts interview questions

Sunday, 20 November 2011

Java interview questions: - 14 important questions asked on String Handling.

During interview following are  Java interview questions which is asked by the interviewer. So do prepare for the interview on this 14 important questions: -
  • Is String a primitive data type in Java?
  • What is the difference between String and String Buffer?
  • Which gives more perform String or StringBuffer?
  • What is difference between string and StringTokenizer?
  • Which package does define String and StringBuffer classes?
  • Which method can be used to obtain the length of the String?
  • How do you concatenate Strings?
  • Which method can be used to compare two strings for equality?
  • Which method can be used to perform a comparison between strings that ignores case differences?
  • What is the use of valueOf( ) method?
  • What are the uses of toLowerCase( ) and toUpperCase( ) methods?
  • Which method can be used to find out the total allocated capacity of a StrinBuffer?
  • Which method can be used to set the length of the buffer within a StringBuffer object?
  • What is StringBuilder?
View the following video on tiles integration with Struts 2: -



Visit for more  Java/J2EE interview questions series.
Regards,

Also visit author’s blog for more Java/J2EE interview questions

Friday, 18 November 2011

Java interview questions: - 16 most asked important questions on Input and Output (I/O).

Following are the sets of 16 most asked  Java interview questions by the interviewer during the interview.
  • What is the difference between the Reader/Writer class hierarchy and the InputStream/OutputStream class hierarchy?
  • What is the purpose of the File class?
  • What an I/O filter?
  • What is the difference between the File and RandomAccessFile classes?
  • What is Serialization and deserialization?
  • What is the difference between Serializalble and Externalizable interface?
  • Which methods of Serializable interface should I implement?
  • What is the purpose of the Runtime class?
  • What is the purpose of the System class?
  • What is the Properties class?
  • How many methods in the Externalizable interface?
  • What class allows you to read objects directly from a stream?
  • What happens to the static fields of a class during serialization?
  • How do I connect a Reader to an InputStream?
  • How many types of IOStream are present?
  • What is the use of non blocking IO?
Also see the following interesting video on Inheritance between beans and Spring: -

Know more on  Java interview questions
Regards,
Get more on Java interview questions from author’s blog

Tuesday, 15 November 2011

Java/servlets interview questions: - Session tracking and methods for session tracking.

This is one of the asked Java/J2EE interview questions during an interview. So one can start proceeding with the answer as follows.

Session tracking is a mechanism that servlets use to maintain state about a series requests from the same user across some period of time

Following are the methods for session tracking: -
  • User Authentication - occurs when a web server restricts access to some of its resources to only those clients that log in using a recognized username and password.
  • Hidden form fields - fields are added to a HTML form which is not displayed in the client’s browser. When the form containing the fields is submitted, the fields are    sent back to the server.
  • URL rewriting - every URL that the user clicks on is dynamically modified or rewritten to include extra information. The extra information can be in the form of extra path information, added parameters or some custom, server-specific URL change.
  • Cookies - a bit of information that is sent by a web server to a browser and which can later be read back from that browser.
  • HttpSession- places a limit on the number of sessions that can exist in memory.

See the following video on Value List Handler as follows: -



Click and get to see more on  Java/J2EE interview questions series.

Regards,

Also visit author’s blog for more Java/J2EE interview questions

Saturday, 12 November 2011

Java interview questions: - What are the functions present in Queue interface?

This is one of the typically asked  Java interview questions in most of the Java interview.
  • public boolean offer(Object element): return false if the object cannot be added to the collection due to size issue and without throwing unchecked exception.
  • public Object remove(): behaves like the Collection interface version.
  • public Object poll(): behaves just like remove() but when invoked on empty collection returns null without throwing exception.
  • public Object element(): for querying the element at the head of the queue. Throws exception when a collection is empty.
  • public Object peek(): for querying the element at the head of the queue. Returns null if the collection is empty.
Also see Batch Processing video in Hibernate of  Java interview questions



Visit for more  Java/J2EE interview questions series.

Regards,

Also visit author’s blog for more Java/J2EE interview questions