Abstract Class in Java provides a mechanism by which we can just define the definition of the method in class and not implement it. Any Class that extends the Abstract class has to implement the abstract …
Category: Technical
As we have seen in the previous tutorial that member variables and methods of SuperClass can only be accessed in subClass if they are declared as public. There are multiple uses of super keyword in Java, …
Inheritance is one of the most important features of Java. With Inheritance you can extend the features defined in one class into another Class. Thus promoting code reusability. The Class which one extends into new Class …
The Object Class is one special class in Java. All the other classes are subclasses of Object class. That means Object is superclass of all other classes. Object Class defined the following methods. Method Purpose protected …
With Java you can write a Class that is enclosed within another Class. These are called Nested Class. ONe Usually goes for Nested Class when the New Class which you are creating is very closely Associated …
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 …
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 …
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 …