Interview Questions In Java For Selenium

Part 10

46 : What is Polymorphism?
Answer : Polymorphism is ability using which we can create reference variables or methods which behaves differently in different programmatic context. Best example of polymorphism is human. We behaves differently with different people in different environment. Our behavior will be different when we meet to boss and meet to friend. Read more on Polymorphism in java.

47 : What is the advantages of Polymorphism?
Answer : Main advantage of polymorphism is code reusabilty. You can dynamically supply different implementations through polymorphism. So it will reduce your work volume in terms of handling and distinguishing various objects.

48 : What is a package?
Answer : A package is a namespace which allows developer to organizes a group of related classes and interfaces. Conceptually it is just like folder which contains different types of files. It is easy to keep things organised by keeping related classes and interfaces into packages.

49 : What is string in java?
Answer : In Java programming, String is object which is prepared by sequence of package has String class to create and manipulate strings. Read more on string in java.

50 : What is StringBuffer in java?
Answer : StringBuffer help us to create mutable(modifiable) string in java. That means we can modify the string if we use StringBuffer.