Posts

Showing posts with the label Q & A

Overloading and Overriding with Polymorphism in java

Polymorphism is a Greek word. Poly means many moprhism means form. In java one form is using for multiple uses is called polymorphism. It is mainly two types. That are called             •    Compile time polymorpshism/static polymorpshism             •   Runtime polymorphism/dynamic polymorphism           Static polymorphism is called the overloading and dynamic polymorphism is called overriding in java.  At the time of method overloading java compiler will understand which  method is calling, is called static polymorphism. At the time of compilation java compiler will not identifies which method is calling exactly, that will understand JVM at the time of runtime is called Overriding in java.             Overloading again two types, that are method overloading and constructor overloading. But, constructors we can't override in java, because of ambiguity. Method Overloading: Which of two or more methods declared with the same method name with different signature i

String interview questions and answers

String interview questions and answers are placed the current post as of my experience in interviews. This will helps who are trying to attend interview as fresher as well as experience. If any one is facing any other questions which are not present in the current page, please drop me an email to " subbareddynallamachu@gmail.com ".  Q1:  String is a class or data type? A: String is a class in java.lang package. But, in java, all classes are also are considered as data types. So we can take String as data type also. Q2:  What is the difference between == and equals() methods in java? A: == operator compares the references of the String object. It does not compare the content of the object. equals() method compares the contents. While comparing the Strings, equals method should be used as it yields the correct result. Q3:  What is String constant pool? A: String constant pool is a separate block of memory where the String objects are held by JVM. If a String object is create