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 Using Abstraction Provides a contract for …
Category: Java
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 return the length of longest character sequence as …
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 …
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 means that each element in the …
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 problem without Autoboxing and unBoxing. public …
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 methods to perform add, …
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 …
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 …
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 …
Java language revolves around the Object Oriented Programming (OOP), the base of OOP is Classes and Objects. This post is dedicated to Understanding the need for OOP and about Classes and how that works. As the …