BigDecimal in Java
While reading about primitive date types in Java we get to know that we should use float and double primitive types for decimal numbers. But there is one problem with these primitive types float and...
View ArticleBigInteger in Java
Though not very common but you may come across a scenario where you’d want to store an integer whose value goes well beyond the limit of the primitive types like int and long. As example if you have to...
View ArticleSerialization in Java
Object serialization is the mechanism of converting object into byte stream. Where as the reverse process of constituting the object from those bytes is known as deserialization.Use of...
View ArticleTransient in Java
In the post Serialization in Java it has already been discussed that serialization is the mechanism by which any object can be converted to byte stream. By default all of the object variables are...
View ArticleExternalizable interface in Java
Though serialization in Java provides a pretty good default implementation for serializing and deserializing an object. All you need to do is to implement Serializable interface and the whole process...
View ArticleserialVersionUID and versioning in Java Serialization
If you ever implemented Serializableinterface then you would have seen the warning “The serializable class XXX does not declare a static final serialVersionUID field of type long”. If you did wonder...
View ArticleSerialization Proxy Pattern in Java
When you serialize an object in Java it is converted to byte stream and object is reconstituted using that byte stream during the process of deserialization.Sometimes this extraneous behavior of...
View ArticleObject cloning in java
In Java if you assign an object variable to another variable the reference is copied which means both variable will share the same reference. In this case any change in one object variable will be...
View ArticleReading all files in a folder - Java Program
This post is about how to read all the files in a directory. Suppose you have folder with files in it and there are sub-folders with files in those sub-folders and you want to read or list all the...
View ArticleCompressing and Decompressing File in GZIP Format - Java Program
You will mainly use GZIP tool to compress and decompress files in Unix systems. Here note that you can only compress a single file using GZIP not multiple files residing in a folder.Steps to compress a...
View ArticleCreating tar file and GZipping multiple files - Java Program
If you want to GZIP multiple files that can’t be done directly as you can only compress a single file using GZIP. For that you will have to archive multiple files into a tar and then compress it to...
View ArticleHow to untar a file - Java Program
This post shows how to untar a tar file. It has both the steps to first uncompress a .tar.gz file and later untar it.Refer Creating tar file and GZipping multiple files to see how to create a tar...
View ArticleNested class and Inner class in Java
In Java programming language you can define a class within another class. Such a class is called nested class.Nested class categoriesNested classes are divided into two categories - Static nested...
View ArticleArithmetic and Unary Operators in Java
For basic mathematical operation the Java programming language provides arithmetic operators like addition (+), subtraction (-), division (/), multiplication(*) and modulus (%, which divides one...
View ArticleEquality and Relational Operators in Java
The equality and relational operators evaluate the relationship between the values of the operands. These operators determine if one operand is greater than, less than, equal to, or not equal to...
View ArticleConditional Operators in Java
The conditional operators Conditional-AND (&&) and Conditional-OR (||) perform operations on two boolean expressions. Result is also a boolean value of true or false based on whether condition...
View ArticleDifference between equals() method and equality operator == in Java
Difference between equals() method and equality operator “==” is a frequently asked interview question. At the same time it may be a bit confusing for the first-time Java programmer to get the subtle...
View ArticleHow to swap or exchange two numbers without using any temporary variable -...
How to swap or exchange two numbers without using any temporary variable is asked quite frequently in Java interview questions. This post shows one way to solve this - public class Swap { public static...
View ArticleHow to remove duplicate elements from an array - Java Program
How to remove duplicate elements from an array is a frequently asked interview question and you may be asked to do it without using any of the collection data structure like List or Set or you may be...
View ArticleObject class in Java
Object class is root class of all classes in Java. All classes descend from object directly or indirectly. It is implicitly extended by a class if it is not extending any other class. In case, a class...
View Article