Wednesday, May 20, 2009

Java interview Questions

Java Interview Questions

What is the difference between Checked and Un Checked Exception?
Diff between Vectors and Arrays?
3. Diff between Vectors and Array List?
What are Hash Map and Hash Map Table?
What is polymorphism?
What is diff between early and late binding?
Can u have polymorphism besides implementing an interface?
Diff between multitasking and multithreading?
What are the two ways of creating and instantiating a thread?
Diff between interfaces and abstract classes?
When would you use an interface and when would u use an abstract class?
Can an abstract class have all non-abstract methods defined in it? When would u use this?
Ans. Yes this is when u don’t want the class to be instantiated by other class.
Can constructors be protected or private? Or without any access modifier?
What are advantages of jdk1.4 over jdk1.1?
What are short-circuit logical operators?
What is multiple Inheritance?
Why can we extend only one class at a time in java and implement various?
What are inner classes? Y is the name given as inner classes?
What are linked list?
Define Overloading and overriding?
What are static variables or objects?
Define transient, volatile, synchronized and final class?
How do u access database without using the Connection object?

JSP Interview

What are the steps involved in creating an EJB?
Types of EJB’s. describe each.
Life cycle of a servlet?
How to use java beans in a jsp
Ans.
What is the parameter that is passed to the init method of the servlet?
Ans. ServletConfig object
You have a servlet with an init method, dopost method doget method and service method. If the type of request sent from the HTML page is POST wht is the order of execution of methods in the servlet?
Diff between and include directive.
How are methods defined in JSP?
Ans. <%! %>
Diff include and send redirect .
Diff between PreparedStatement and Statement?
How do u access the session object in JSP?
Ans. PageContext.getSession();
Diff between naming.bind() and naming.rebind()?
Ans. Gain access to output parameters sent by stored procedure.
What is the significance of init, service and destroy methods in a servlet?
Should all the methods defined in Remote Interface throw Remote Exception?
Which method is used to get the output stream to write the output to the client?
Ans. response.getOutputStream()
Which method is used to get the IP address of the client sending the request?
Ans. request.getRemoteAddress()
How to access an implicit variable “exception” in a JSP?
Ans. set “isErrorPage” attribute in the page directive to “true”.
In case of RMI what has to be present at the client side: RemoteInterface, Skeleton or stub?
What are the constraints for objects that can be sent as parameters or return types in RMI? Should it be ‘final’, ‘abstract’ and should it implement ‘Serializable’ class?
Write a program to read a file and write into the other?


Sapient

No comments:

Post a Comment