Core java
- 06 July
Find middle element of a linked list in java
If you want to practice data structure and algorithm programs, you can go through data structure and algorithm interview questions. This is one of the popular interview question. In this post, we will discuss how to find middle element in linkedlist in most efficient way. Java Linked List Interview Programs: How to reverse a linked list […]
- 05 July
How to detect loop in a linked list in java with example
If you want to practice data structure and algorithm programs, you can go through data structure and algorithm interview questions. One of the most popular interview question nowadays is “How to detect loop/cycle in LinkedList”. So I thought I should cover this question. This question is more related to data structure. You can also find start […]
- 22 June
Lambda Expressions in Java 8
1. Introduction Java 8 has introduced a new feature called Lambda expressions. This is considered to be major change for Java because it introduces a way of programming that is more about actions than the details of how things are done. Other languages such as Scala already have this feature so this is not new […]
- 21 June
Interface Default Methods in Java 8
1. Introduction In this post, We will introduce default methods in interface which are introduced in Java 8. Have you ever encountered a situation where you created an interface and several classes implemented it? Now, suppose you need to add new methods to the interface. Doing so would lead to a multitude of compilation errors across […]
- 19 June
Difference between Abstract Class and Interface in java
Some of the popular interview questions are “What are differences between abstract class and interface“. “When will you use abstract class and when will you use interface“. So in this article ,we will go through this topic. Before going through differences between them, Lets go through its introduction. Abstract class Abstract classes are created to […]
- 18 June
Comparable in java
In this post, we will see how you can use comparable to sort list of objects in java. Comparable interface: Class whose objects to be sorted must implement this interface.In this,we have to implement compareTo(Object) method. For example: [crayon-67446fa4711b7062026281/] If any class implements comparable inteface then collection of that object can be sorted automatically using […]
- 17 June
Method overloading in java
If two or more methods have same name , but different argument then it is called method overloading. Why you would do that (same name but different argument)? Lets take an example. You want to print salary of employee and sometimes company gives bonus to their employee and sometimes it don’t.So If company don’t give […]
- 17 June
Comparator in java
In this post, we will see how you can use comparator to sort list of objects in java. Comparator: When you want to sort the list of objects of a class,you can use Comparator interface. You don’t need to implement Comparator on the class whose objects need to be sorted. You can create a separate […]
- 17 June
Method overriding in java
If subclass is having same method as base class then it is known as method overriding Or in another words, If subclass provides specific implementation to any method which is present in its one of parents classes then it is known as method overriding Lets start with a real time example: In a small organization,There […]