You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Strings are immutable, that means the contents of string objects can't be modified after their creation. i.e, When you try to alter the string, it creates a new string. Due to this behavior, the internal state of a string remains the same throughout the execution of the program. This characteristic of immutability helps with the benefits of caching, security, synchronization, and performance.
212
213
213
214
**[⬆ Back to Top](#table-of-contents)**
214
215
215
-
7.### What is the difference between StringBuffer and StringBuilder
216
+
8.### What is the difference between StringBuffer and StringBuilder
216
217
217
218
String is an immutable class to represent sequence of characters. Java also provided mutable version of String class through StringBuffer and StringBuilder. Even though both these classes are mutable, there are many differences between StringBuffer and StringBuilder.
8.### What is the importance of hashCode() and equals() methods
230
+
9.### What is the importance of hashCode() and equals() methods
230
231
231
232
Since both `equals()` and `hashCode()` methods are available in Object class(i.e, Java.lang.object), every java class gets the default implementation of equals and hashCode methods. These methods work together to verify if two objects have the same value or not.
Wrapper classes provides the mechanism to convert primitive types into object types and vice versa. Since Java is an object-oriented programming language, and many APIs and libraries in Java require objects instead primitive types. For example, data structures in collection framework, utility classes from `java.utils.*`,cloning process, Serialization, Synchronization etc require object type.
11. ### What is the difference between abstract class and interface
387
+
12. ### What is the difference between abstract class and interface
387
388
388
389
Both Abstract class and interface are used to define contracts in object-oriented programming. But there are some key differences between them as shown below,
Marker interfaces are interfaces that don't have any fields, methods, or constants inside of it. They are also known as empty interfaces or tag interfaces. Examples of marker interfaceare Serializable, Cloneable and Remote interface. The purpose of marker interfaces are to provide run-time type information about an object to JVM and Compiler. They are mainly used in API development and in frameworks like Spring to provide additional information to the class.
14. ### What are the differences between arraylist and vector?
469
+
15. ### What are the differences between arraylist and vector?
469
470
470
471
Both Vector and ArrayList use dynamically resizable array as their internal data structure and implement the List interface. But there are couple of differences between them as listed below,
0 commit comments