This is a new series of sharing core Java interview question on Finance domain and mostly on Big Investment bank. Anybody who is preparing for any Java developer Interview on any Investment bank can be benefited from these set of core Java Interview questions. I have collected these questions from my friends and I thought to share with you all. I hope this will be helpful for both of us. Please share answers for unanswered question and let us know how good these interview questions are.
1. What is immutable object? Can you write immutable object?
You need to make class final and all its member final so that once objects gets crated no one can modify its state. You can achieve same functionality by making member as non final but private and not modifying them except in constructor.
2. Does all property of immutable object needs to be final?
Not necessary as stated above you can achieve same functionality by making member as non final but private and not modifying them except in constructor.
3. What is the difference between creating String as new () and literal?
When we create string with new () it’s created in heap and not added into string pool while String created using literal are created in String pool itself which exists in Perm area of heap.
4. How does substring () inside String works?
Another good question, I think answer is not sufficient but here it is “Substring creates new object out of string by taking a portion of original string”.
5. Which two method you need to implement for key in hashMap ?
(equals and hashcode) read How HashMap works in Java for detailed explanation.
Read more: TIBCO RV FIX PROTOCOL JAVA TUTORIAL
0 comments:
Post a Comment