Java Interview Questions with Answers-Java Frequently Asked Questions

Java Interview Questions With Answers-Java Frequently Asked Questions

Now a days Java technology is very important for software industries.So many software industries offered java technology,in java having so many modules like core java(J2SE),Advanced java(JDBC,Hibernate,Springs,Struts etc.) with best salary packages rather than other technologies.Candidates who are wants to work in the domain of java, for those candidates we will give some important Java Interview Questions With Answers-Java Frequently Asked Questions.These questions are frequently asked by the recruiters,so we try our level best to provide you the java interview questions which should be in your to do list before going to java interview questions in technical interview.

Java interview questions

Some Java Interview Questions With Answers-Java Frequently Asked Questions:

1.which two method you need to implement for key object in HashMap?

In order use any object as key in HashMap,it must implements equals and hashcode method in java.Read how HashMap works in java for detailed explanation on how equals and hashcode method is used to put and get object  from HashMap.

2.What is immutable object?Can you write immutable object?

Immutable classes are java classes whose objects are can’t be modified once created.Any modification in Immutable object result in new object.

3.What is the difference between creating String as new() and literal?

When we create string with new() operator,its created in heap and not added into string pool.While string created using literal are created in string pool itself which exists in PermGen area of heap.

String s=new String(“Test”);

4.What is difference between String Buffer and String Builder in java?

String Builder in java is introduced in java 5 and only difference between both of them is that String Buffers are synchronized while String Builder is non synchronized.

5.what is the difference between ArrayList and Vector?

This question mostly used as a start up question in technical interviews on the collection of framework.

6.how do you handle error condition while writing stored procedure are accessing stored procedure from java?

Stored procedure should return error code if some opertaion fails but if stored procedure itself fails than catching SqlException is only choice.

7.What is the difference between factory and abstract factory pattern?

Abstract factory provides one more level of abstraction.Consider different factories each extended from an Abstract factory.

8.Can you write code for iterating code over hashmap in java 4 and java 5?

Managed to write using while and for loop.

9.When do you override hashcode and equals()?

If you want to do equality check or want to use your object as key in hashmap.

10.What is issue with following implementation of compare To() method in java?

public int compareTo(Object o){

Employee emp=(Employee emp);

return this.id-o.id;

}

Click Here to Download For More Java Interview Questions.

1 Comment

Comments are closed.

SSC Recruitment, Results 2016 © 2016 | Sitemap | Privacy Policy & Disclaimer