A Java Enum is a special Class that is used to defined a collection of constants. An Enum can contain constant, methods, etc. It was added in Java 5.
Enum Example
Consider a simple example to unders...
Interface in Java defines a IS-A relationship between classes and a mechanism to achieve abstraction. An Interface only consist of method definition and not the method body.
Benefits of U...
Problem: Write a Java code to find the longest sequence of consecutive repetitive characters in a String. For example if a String is "aaaabbbbcccchhhhiiiiibbbbbbbbbccccccc" then your code should retur...
String Class in Java is most commonly used data type to Store sequence of characters and although it is not a primitive data type it is so closely available with Java Library that it's as good as a pr...
LinkedList in Java are a better alternative to Arrays, and provides almost all functionality that a ArrayList provides. LinkedList uses a doubly LinkedList to store and navigate the elements. This mea...
Autoboxing and unboxing is a mechanism provided by Java to automatically convert primitive Data Type into its corresponding Wrapper Class Object and vice versa.
Consider the Code below of the probl...
ArrayList is part of Collections Framework in Java and is a implementation of List Interface. As opposed to Java Array of fixed size. ArrayList in Java are resizable-arrays and provide various utility...
As we have learned about Primitive Data Types and Classes in Java. It is a good time to dig into the details of String class in Java. String is a special Class in Java which is so closely bound with t...
Constructors are the special methods in Java which gets executed as soon as we create an object of the Class. To create a Constructor in Class, you need to create a method with name same as your Class...
Lets take a closer looks at methods in Java. As we have seen Class consist of state and behaviour. Methods are defined in Java Classes so alter the behaviour of objects.
Let's consider a Java code...