SerialVersionUID in Java
In this post, we will see more details on SerialVersionUID and also issues with default serial version id. SerialVersionUID: Java uses serialVersionUID field for versionsing. It’s a static and final…
In this post, we will see more details on SerialVersionUID and also issues with default serial version id. SerialVersionUID: Java uses serialVersionUID field for versionsing. It’s a static and final…
In this tutorial, we will learn more and in detail on Java Serialization and Deserialization. Java serialization is very import topic and every developer should know this topic. Serialization: Java…
In Java, serialization works with inheritance in the following way: If a class implements Serializable, its subclasses will also be serializable, regardless of whether the subclasses implement Serializable or not.…
In Java, serialization of inner classes can be a bit tricky due to the relationship between inner classes and their enclosing classes. Static inner classes are serializable just like any…
Circular references during serialization in Java can cause StackOverflowError or OutOfMemoryError exceptions. This happens because a circular reference creates a loop in the object graph that the serialization process tries…
Example Custom serialization in Java: import java.io.*; class Person implements Serializable { private static final long serialVersionUID = 1L; private String name; private int age; public Person(String name, int age)…
The writeReplace and readResolve methods in Java allow you to customize the serialization and deserialization process of an object. writeReplace is called during the serialization process. This method provides an…
This is one of the most common datastructure interview questions and to validate parenthesis. Examples of valid parentheses: (()){}{} Examples of Invalid parentheses : ({) or {(((()))) Problem: Given a…
In this post, we will see Valid Parenthesis with stack. This solution uses a counter to keep track of the balance of parentheses. Whenever an opening parenthesis is encountered, the…
Problem : Given of size ‘n’ and a values ‘k’ around which we need to right rotate the array. Array: [1,2,3,4,5,6,7], K = 3 Rorate1: 7,1,2,3,4,5,6 Rotate2: 6,7,1,2,3,4,5 Rotate3: 5,6,7,1,2,3,4 Solution…