implement a custom class that behaves like an array in Java
We can implement a custom class that behaves like an array by creating a class that has an array as a private field, and implements the necessary methods to access…
We can implement a custom class that behaves like an array by creating a class that has an array as a private field, and implements the necessary methods to access…
What is the difference between an interface and an abstract class in Java? In Java, an interface and an abstract class are both used to define a contract for classes…
In Java, a String is an immutable object that represents a sequence of characters. It means once a String is created, its value cannot be changed, any operation that appears…
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 see serialization and deserialization of Enums and sample java codes. Enums Serialization: Java’s Serializable interface handles serialization of enums in a special way. Enum types…
1. What exception will be occurred with below code? int a = 100; int b = getSumOfProducts(); // This method returns 0 values int c = a/b; NullPointerException ArithmeticException IOException…
When a class implements to Comparable interface, what method must also be implemented? compareTo toString compare equals Answer: 1 – CompareTo Which of the following declaration is correct that MAX…
1. You have a Employee class with a public String field departmentName. In you program’s main method,you create a Employee instance e1. What is output of the below code ?…