Java interview question set-2
1) Explain java class loading hierarchy? What will the sequence of class loading if we have classpath, ear file and war file?
In this case first classpath library will be loaded first and then it will load application ear file library and after this default class loader will load class from web-inf\lib directory. Below is common class loading hierarchy.
2) Puzzle: if you have 5 kg gold bar and you have employee and his salary is 1 kg gold per day. We have to pay every day 1 kg to the employee how many cut we will do in gold bar to give him salary every day?
answer : 2 cut and we will have 1 , 2 and 3 kgs bar and it is sufficient to give him every day 1 kg gold salary.
3) Why we need Wrapper class?
4) Is this class immutable?
public void method1(StringBufer sb){
}
No, As in java object reference is passed as value to method parameters, in above case StringBuilder reference is passed to the class which can change latter and it will modify the StringBuilder instance in class.
5) Difference in Runnable and callable?
6) Difference in Callable return method and Futures?
7) Vertical scaling Vs Horizontal scaling?
Vertical scaling
Vertical scaling, also described as scale up, typically refers to adding more processors and storage to an Symmetric Multiple Processing to extend processing capability. Generally, this form of scaling employs only one instance of the operating system.
Horizontal scaling
Horizontal scaling, or scale out, usually refers to tying multiple independent computers together to provide more processing power. Horizontal scaling typically implies multiple instances of operating systems, residing on separate servers.
8) Why notifyAll, notify methods are defined in Object class?
9) What is liveLock?
Technical interview :
Round 1:
1) Executor framework: How this framework decides it has to increase the threadpool size?
2) What is Deque and where it is useful?
3) Java 1.7 changes ?
4) What is immutable Objects and how we can hide some implementation through client class?
5) What is overriding ? and What is child is overriding the method and throwing the different exception?
6) Difference in comparable and comparator?
7) PriorityBlockingQueueExample explain what it is?
Round 2:
1) Explain your current project?
2) Explain Visitor design pattern?
3) If thread is creating the Object it is created in heap or stack?
4) If object is created inside thread then where the object is going to be created? stack or heap?
5) What is method overloading?
6) Generic Eraser in java?
7) What is spring Initialization Bean interface?
8) explain consumer - producer problem in multi threaded environment?
9) How hashmap performance can be degraded?
10) If we call child.add( double, double), which method will be called?
as int and double are autoboxed
parent class
add( int , int)
child class
add(double, double )
11) what is lock stripping implemented in java 1.5 ?
12) How to find out loop in linked list?
answer : tortoise and rabbit idiom

Comments
Post a Comment