Interview questions

JAVA interview questions – page 2

2,804 questions. Tap “Show answer” to check yourself.

  1. Can JMS utilities automatically re-establish a connection if one side of the communication link (i.e. an application that's sending/receiving messages) goes down and is restarted? Are there APIs to help detect that the other side broke a connection (w

  2. During inheritence if we have an overrided method in child class an suppose define the object as Base b=new Child(); b.method(); will call the method of the child class right? then we have to design a system as during the c...

  3. According to Section 3.4 of the JMS Specification, a client can effectively set only three of the message header fields. All the others are set either by the JMS provider or by the send or publish method. Why do all the fields have a setter method, when a

  4. Write classes/methods to calculate the totallength of a set of lines given the start and end points taking into account overlapping.E.g.Line 1 start: -1.4, end: 3.2 Line 2start: 2.9, end: 4.1etc..Total length would be:line 1 length = 4.6 line 2 length =1.

  5. Why java does not support inheritance of multiple superclasses?what is achieved by inheritance?why there is no main method in servlets/jsps?

  6. What is collection framework?what interfaces and classes support collection framework?

  7. 1-explain singleton pattern in java2-explain up casting and down casting3-how do u code a singleton in java4-How do u read XML file in java5-gine an example of the Decorator pattern in the java API.6-What r the services provided by the container?7-what r

  8. What is the difference between Java and J2EE? Is J2EE advanced version of Java?

  9. If i throw a custom ApplicationException from a business method in Entity bean which is participating

  10. In Java, You can create a String object as:String str = "abc"; &String str = new String("abc");Why cant a button object be created as : Button bt = "abc"Why is it compulsory to create a button object as: Button bt = new Button("abc");Why is this not compu

  11. What is difference between instance and object.?what are the all difference between interface and abstract class?

  12. How do you push an applet in to the servlet?

  13. What is the Difference between Design Pattern and Architecture? Can any one answer for this plz..

  14. Why do we override the execute method is struts? Plz give me the details?

  15. What is the difference between Applet and japplet? What are the traverses in binary tree? Write down how will you create a Binary tree? What is constructor and virtual function? Can we call a virtual function in a constructor? give example.

  16. In Java, variables are passed by value or reference

  17. Whether we can set the time implicitly for the garbage collection?

  18. The following code is executed by a multi-threaded environment:public void functionOne() {System.out.println("Staring itrs= " + this.cntr);for( int i=0; i<this.cntr; i++ ) {System.out.println("iteration: " + i);}System.out.println("completed");}and when r

  19. What is optional dependency

  20. I need some more information about interface. For Example there is no any functionality inside the method which is declared in any interface. Then why i want to implement that interface to my class. 2. Statement is an interface. When i say stmt.executeQue

  21. If my java based application is hanging once in a while. Where would you start looking at the problem, what changes can you do? My application has a builtin Ldap client and is communicating with a Ldap server. now having a problem with the authentication,

  22. Can You catch the Error? 2. Difference between compiletime exception and runtime exception?3. How you throw user defined exception?4. How you handle throwable while using exceptions ?5. What are the methods available in Object ?6. Is there any methods ava

  23. 1)What are the actual functions of JVM?2)When to use a class and when to use an Abstract class?3)what is the use of constructors other than creation of objects? 4)when to use constructors?5)when to use Interface?6)why java does not support pointers?7)why

  24. How to define an Interface?

  25. What will happen if we add the same object to the Set?

  26. What is static block?

  27. When should we use session bean/entity bean?I was unable to judge? For Example :For Airline Project where we can use EJB's? How can we differentiate the stateful and stateless session beans?

  28. What are the Applet's Life Cycle methods? Explain them? - Following are methods in the life cycle of an Applet

  29. How to use JNI in java? and what are Struts and jini?and how to apply native code in java?

  30. Difference between String and stringBuffer?

Companies that ask JAVA questions