Telephonic Java Interview Series 35
This is another telephonic java interview questions which was asked in Citi bank NY for Sr. Java Developer position:
1. What is finalize in Java
2. How you do your own garbage collection
3. How many types of garbage collectors are there in Java
4. If you want to use G1 Garbage Collector how you will do that
5. What is hashing in Java
6. How Hashmap works in Java
7. What happens when two object hash codes are same
8. What is immutable
9. How do you create immutable class
10. How do you set variable in immutable class
11. Let’s say if we have person class which is immutable and has reference of address class. How you make address class immutable.
12. Is Java pass by reference or pass by value
13. Why Java is pass by value can you give me example
14. If you have class name Person which defined some variable and another class instantiate person class setting it value. Another method you are passing person object but before access you are making person object null. If you do print value of person what will you get.
15. Is Hashmap thread safe in Java
16. How you can make Hashmap thread safe
17. As you said there is two way to make it thread safe: Collections.synchronizedMap or ConcurrentHashMap. What is the difference if you use ConcurrentHashMap and how it works.
18. What is synchronized in Java
19. What it does when you do method synchronized
20. Which object Java put lock in case of synchronization
21. Let say if you have synchronized operation in Person class and other class creating 100’s of person object then which object Java will put lock