Let’s learn about the comparable and comparator interface in java and when should we use them

Comparable and Comparator are used when we want to sort a collection in Java. But in what situation should we use Comparable or Comparator Interface? What are the differences between Comparable and Comparator Interface? In this article, I will explain both the interfaces and the best situation to use them.

Comparable Interface is present in java.lang package and they only contain one method i.e.

public int compareTo(Object obj)

The method returns three values i.e. negative, position, and zero. Let’s take a simple example to understand in detail.


if obj1 comes before obj2 then it returns a negative number. if…

In this article, we will have an overview of different types of DBMS languages and their functionalities.

Img src : javatpoint
Img src : javatpoint


DDL stands for data definition language. it deals with schema and structure. It is used to establish and modify the structures of objects. It is used to define schema, tables, indexes, constraints. Let’s learn in brief about all these commands.

CREATE command is used to create a new database, create a new table in the database, create index value (index values helps to speed up search and queries)

ALTER command is used to add, delete, or modify a column in existing tables.

Let us discuss in brief Centralized Database and Distributed Database and their advantages.

The database is a collection of data that are stored in an orderly manner. There are various types of databases that are suitable for different working scenarios. We will discuss two of the important types of databases that is Centralized Database and Distributed Database. These databases are commonly used in different kinds of organizations.

Centralized Database

In a Centralized database, data are located, stored, and maintained in a central location. The centralized location can be accessed through the help of an internet connection like WAN or LAN…

In this project, we will learn to create a Client-Server console application in Java. The project will help us to understand the low-level network communication, and also a low-level understanding of how popular chat applications like messenger and WhatsApp are built.

You can find the source code on my Github account or you can watch the video tutorial on my Youtube Channel

Sockets Programming helps us to communicate with the various computers running on a network. In Java, Socket programming can be either connection-oriented or connectionless. We will design the connection-oriented application that uses the Client-Server model.

In the Client-Server model, the Server has a unique IP Address and port number. The client tries to make a connection with the server using this port number and IP address. The server listens and accepts the connection. …

In this article, I will explain what is String Class and what is StringBuilder Class, and what are the major differences between them.


The string is the most widely used class in Java Language. One of the important features of String Class is it is immutable. This means once the String object is created, it can never be modified. The main advantage of this feature is it helps to reduced memory overhead and increase performance.

String uses a char array to store its value, and final keyword so that its values are never modified, once assigned. …

In java, there are basically two types of modifiers: access modifiers and non-access modifiers. In this article, we will be talking about access modifiers in java and their scope in class, constructor, methods, variables, or data members.

There are basically 4 types of Java access modifiers. They are public, protected, private, and default. Among these four modifiers, public modifier is considered the least restrictive whereas the private modifier is considered the most restrictive. Default modifiers are the results when we don’t use any kind of modifier. We will be talking in more detail about each of these modifiers.

Private Access Modifier

Private access modifiers are considered to be the most restrictive modifiers. The member with private access modifier is accessible only within the class in which they are declared. …

Creating an Angular Project

For visual learner, you can watch the tutorial from youtube. link

In this brief article, I will be explaining how to read CSV files in the Angular Project. We will be using CSV file provided by CDC in the project. The link is


First of all, we will start our project. You can type the following code on your command panel or terminal to start the project.

ng new read-csv

After the project has been successfully created. We will be creating a service in Angular that will help us to interact with our CSV file. …

Amit Gyawali

Software Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store