Morgan Stanley Java Interview Questions
- What is the difference between abstraction and polymorphism?
- What is encapsulation?
- How to print repeated no. stored in an array? using hash Set , using Hashmap
- How to swap to string without using third variable ?
public class SwapToString {
public static void main(String[] args) {
// TODO Auto-generated method stub
String a="Hellow";
String b="World";
System.out.println("String before swap " + a+ " "+b);
a=a+b;
b=a.substring(0,a.length()-b.length() );
System.out.println(b);
System.out.println(a);
System.out.println(a.substring(b.length()));
}
}
-----------------------
o/p
String before swap Hellow World
Hellow
HellowWorld
World
- what and all design pattern you have worked on?
- What is factory design pattern ?
- What is singleton design pattern ?
- How do you create your own singleton class ?
- How do you create your own immutable class?
- Why is String immutable?
- What is the difference between String a="abc"; and String a = new String("abc");
- what is intern in string ?
- what are the memory structure in java?
- where does SCP belongs , which memory area?
- how many objects (String) are getting created in the question 11?
- what is the significance of each key word in case of your own implemented immutable and singleton class like final , static etc?
- What happens when you override static method in java?
- What is overriding and overloading in java?
- What happens when you try to overload a method only by changing the return type?
- what is metadata and premgem in java?
- How to make singleton class in case of multithreading environment ?
- How does synchronized work in java ?
- How does internally hashMap works?
- Is it good if you want to use a large no of bucket in hashMap?
- What and all collections have you used ?
- What is the difference between ArrayList and LinkedList?
- When to use arrayList and linkedList ?
- What and all you need to keep in mind if you are creating a hasMap with key as Employee and value any thing else ?:- Here key must be immutable and need to override equals and hascode?
- What is the contract between equal and Hashcode ?
- Have you worked on java 8?
Comments
Post a Comment