Monday, March 19, 2012

More Core Java Interview Question for experienced Developers

Q 1) Does StringBuffer always give better performance then concatenation using + ? In which case StringBuffer will give better performance then concatenation using +?

Q2) How does garbage collector decide which objects are to be removed? Can garbage collector be forced?

Q3) What is the difference between an argument and a parameter?

Q4) What are wrapper classes?

Q5) What is difference between Collections and Collection?

Q6) What is connection pooling and what are the advantages of connection pooling?

Q7) What is Servlet?

Q8) What exactly is “Code once and run anywhere” property of Java? How does Java achieve this behavior?

Q9) What happens when we run this code?
class Test {   public static void main(String args[]) {
    ArrayList alist = new ArrayList();     alist.add(new String("A"));     alist.add(new String("B"));     alist.add(new String("C"));      int i = 0;      for (Iterator it = alist.iterator(); it.hasNext(); ) {       System.out.println(alist.get(i++));     }   } }
Q10) 


Hibernate Questions.

1.) What is difference between Uni-directional and Bi-directional mapping in hibernate and which is more suitable?
2.) Suppose there is one to one relationship between Student and Class entity and lazy loading is enabled and we load the Class entity then what will be the initial value of Student entity?

Thursday, March 15, 2012

Java/J2ee Interview Questions for 2+ experienced developers

Q1) Can we have abstract class without abstract methods? If yes then what is the use of abstract class without abstract methods? Give some practical example from your project where you have used this.

Q2) What is singleton design pattern? How will you make ensure that class is singleton. If singleton class implements serializable interface and we are serializing the class then on deserializing a new object of singleton class will be created (as deserialization process creates new object), in this scenario how will you make sure that deserilazation process will not create a new object of the class?

Q3) What design pattern you see in java collestions?

Q4) What is ConcurrnetModificationException?

Q5) Can static method be abstract?

Q6) Why we can not declare abstract methods as static?

Q7) What is difference between forward and send redirect and which one is faster?

Q8) What is the purpose of serialization in java?

Q8) What is the role of serialVersionUID in serialization process?

Q9) What happens when an object is serialized and then a changes is made in the member variable of the class and later on the earlier serialized object is de-serialized?

Q10) How do you achieve version control in hibernate?

Q11) Why would you use a synchronized block v. synchronized methos?

Q12) What is difference between static block and init block?

Q13) Why static methods cannot access non static variables or methods?

Q14) What modifiers are allowed for methods in an Interface?

Q15) What is difference between iterator access and index access?

Q16) How will you sort a collection of String in case sensitive order?

Q17) Arrange in the order of speed - HashMap, HashTable, Collections.synchronizedMap, ConcurrentHashmap

Q18) What is the purpose of overriding finalize() method?

Q19) What is difference between include and forward?

Q20) What is Servlet Container?

Spring Boot Config Server and Config Client.

 In Spring cloud config we can externalise our configuration files to some repository like GIT HUT, Amazon S3 etc. Benefit of externalising ...