Java Interview Questions and Answers Set 8

71.Can we call the run() method instead of start()?

yes, but it will not work as a thread rather it will work as a normal object so there will not be context-switching between the threads.

72.What is Session Facade?

Session Facade is a design pattern to access enterprise bean through local interface. It abstracts the business object interactions and provides a service layer. It makes the performance fast over network.

73.Explain the meaning of Java Applet.

Java Applet is a program that executes or runs in the web browser only. Applets are specifically designed to function and embed with HTML web pages. Applets have the capability to function full Java applications with the entire use of Java API. JVM is a must requirement to view an applet on the browser. Applet extends with the use of java.applet.Applet class.

74.How is JSP used in the MVC model?

JSP is usually used for presentation in the MVC pattern (Model View Controller ) i.e. it plays the role of the view. The controller deals with calling the model and the business classes which in turn get the data, this data is then presented to the JSP for rendering on to the client.

75. What are context initialization parameters?

Context initialization parameters are specified by the <context-param> in the web.xml file, these are initialization parameter for the whole application and not specific to any servlet or JSP.

Weekend / Weekday Batch

76. What are the types of Applets?

Based on location, there are two types of Java applets as Local Applets that are stored on the same computer or system. The Remote Applets that have files on remote systems.

78.What are the transaction management supports provided by spring?

Spring framework provides two type of transaction management supports:

  • Programmatic Transaction Management: should be used for few transaction operations.
  • Declarative Transaction Management: should be used for many transaction operations.

79.What is the advantage of NamedParameterJdbcTemplate?

NamedParameterJdbcTemplate class is used to pass value to the named parameter. A named parameter is better than ? (question mark of PreparedStatement).

80.What are immutable objects in Java?

In Java, immutable objects are the ones whose state does not change after it has been created. Immutable objects are ideal for multi-threaded applications that allow sharing the threads while avoiding synchronization. Immutable objects are preferred for building simple, sound and reliable code to match with an effective strategy.