Face to Face Java Interview Series 12

Face to Face Java Interview Series 12

This is Face to Face Java Interview Series 12 questions from big healthcare company in east coast New York area. Below are questions:

1. Tell me about your project what you did in the past and what is your strong area ?
2. How will you rate in core java, hibernate, spring ?
3. Would you please tell me what will be the out of below program:

public class StringComaprison {

    public static void main(String[] args) {
        String s1 = "abc";
        String s2 = "abc";
        if (s1 == s2) {
            System.out.println(s1);
        } else {
            System.out.println("2");
        }

        if (s1.equals(s2)) {
            System.out.println("3");
        } else {
            System.out.println("4");
        }

    }
}

4. What will be output of below program:

public class IncrementTest {

    public static void main(String[] args) {
        int i = 1;
        int j = 1;

        try {
            i++;
            j--;
            if (i/j >1) {
                i++;
            }
        } catch (ArithmeticException e) {
            e.printStackTrace();
        }catch (Exception e) {
            e.printStackTrace();
        }finally{
            System.out.println("3");
        }
        
        System.out.println("4");
    }

}

5. What will be output of below program:

public class DoWhileTest {

    public static void main(String[] args) {
        int i = 0;
        int j = 0;
        do (i=i++;j--;){
            j--;
        } while (j>0);
        
        System.out.println("print me");

    }
}

6. What are circumstances under which finally block will not execute ?
7. Can we throws exception as below:

public class MethodOverrideTest extends Test {

    public static void main(String[] args) {
        MethodOverrideTest methodOverrideTest = 
            new MethodOverrideTest();
        methodOverrideTest.mehtodA();

    }

    public void mehtodA() throws  RuntimeException{
        System.out.println("test");
    }

}

class Test {

    public void mehtodA() throws NullPointerException  {

    }
}

8. If in hibernate we need to increment id by even number how we will achieve this ?
9. How we generate id automatically in hibernate ?
10. What do you mean by iterator fail-fast property ?
11. We have table employee with column: id,name and table addresses column: id,location and mapping table employee_address with column: emp_id,add_id which is reference of employee and person table. How you will join two table and get data can write SQL query ?
12. What is checked and un-checked exception ?
13. If you have two war file in same spring container and you have same class with same package in both how many times class will be loaded ?
14. What is common document we create in Restful web service similar to what we do create WSDL file for SOAP web service so that consumer of the service will use as service reference document.

Leave a Reply

Your email address will not be published. Required fields are marked *