Programming Archive

Java String compare to determine Equality

java string compare can be done in many ways as shown below. Depending on the type of java stringcompare you need, each of them is used. * == Operator * equals method * compareTo method Comparing using the == Operator The == operator is used when we have to compare the String object references. If

What is the use of serialVersionUID

Here i will discuss about variable serialVersionUID used in Serializable classes. Why is it so important. And why you should use this. Here i will use an example to make you understand the exact use of variable. Example Code [crayon-5a313db4b058e402623483/] (This class will be used to serialize) [crayon-5a313db4b0599474781253/] (This class will be

Java Collection Hashmap tutorial

HashMap HashMap is HashTable based implementation of Map. This is the reason why interviewer always ask for difference between HashMap and HashTable. HashMap is mostly equals to HashTable except below two differences. HashMap is unsynchronized while HashTable is synchronised. HashMap permits null while HashTable doesn’t. Important Property of HashMap DEFAULT_INITIAL_CAPACITY  : Default Initial Capacity(2 power

Java serialization concept and Example

What is Serialization in Java?        Serialization is simply turning an existing object into a byte array. This byte array represents the class of the object, the version of the object, and the internal state of the object. This byte array can then be used between JVM’s running the same code to transmit/read

StringBuffer and StringBuilder In Java

What StringBuffer and StringBuilder In Java? A String Builder is like a String, but can be modified. String has drawback that once created it can not be modified. To overcome that problem StringBuffer and Stringbuilder can be used. Unlike Strings objects of type StringBuffer and Stringbuilder can be modified over and over again without leaving