Vivek Verma has Published 84 Articles

How To Check Whether a Number Is a Pronic Number or Not in Java?

Vivek Verma

Vivek Verma

Updated on 29-May-2025 15:19:37

7K+ Views

What is Pronic number? In mathematical terms, a Pronic number is a number that can be defined as the product of two consecutive integers. The Pronic number is in the form of n(n+1), where n is the integer. For example, the pronic numbers are 0, 2, 6, 12, 20, and ... Read More

How To Check If Three Points are Collinear in Java?

Vivek Verma

Vivek Verma

Updated on 29-May-2025 15:16:06

2K+ Views

In mathematical terms, three points are said to be collinear if all three points lie on a straight line. If the points do not lie on the same straight line, then they are not considered collinear points. Those three points represent coordinates on a plane: (x1, y1), (x2, y2), and (x3, ... Read More

What can cause the \"cannot find symbol\" error in Java?

Vivek Verma

Vivek Verma

Updated on 29-May-2025 05:39:49

12K+ Views

In Java, the cannot find symbol error occurs when we try to reference a variable that is not declared in the program or when we try to access a class that is not declared or imported.  Possible Causes of 'Cannot Find Symbol' Error Below is a list of some possible ... Read More

How to create a thread by using anonymous class in Java?

Vivek Verma

Vivek Verma

Updated on 27-May-2025 16:16:05

4K+ Views

This article will use an anonymous class to create a Thread in Java. An Anonymous class is a class that does not have a name. Thread in Java In Java, a Thread is a part of a program that can be executed independently. All Java programs have at least one ... Read More

What is the use of Object Cloning in Java?

Vivek Verma

Vivek Verma

Updated on 27-May-2025 15:54:32

2K+ Views

The article will explain the use of object cloning in Java and provide an appropriate example to clarify the problem. What is the Object Cloning in Java? In Java, object cloning is a way to create an exact copy of an object. We can use the clone() method provided by ... Read More

How many ways to call garbage collector (GC) in Java?

Vivek Verma

Vivek Verma

Updated on 27-May-2025 15:23:58

2K+ Views

This article explains the different ways of calling the garbage collector (GC) in Java. It also includes a brief introduction to garbage collection, various calling approaches, and relevant examples. Garbage Collection (GC) in Java In Java, the garbage collection is carried out by a daemon thread called the Garbage Collector ... Read More

How to convert between List and Array in Java?

Vivek Verma

Vivek Verma

Updated on 27-May-2025 14:31:46

1K+ Views

In Java, a List is an interface that represents an ordered collection of elements of the same type. You cannot directly create an object of the List interface, instead, you need to instantiate an ArrayList class or another class that implements the List interface.An array is a container that holds ... Read More

How To Check if a Triangle is Valid or Not When Sides are Given in Java?

Vivek Verma

Vivek Verma

Updated on 27-May-2025 13:37:32

9K+ Views

A Triangle is a polygon that has 3 sides, and it consists of three sides and three vertices. The sum of the three internal angles is up to 180 degrees. Below is the diagram of a triangle having three sides (a, b, and c): In a valid triangle, if ... Read More

How to iterate over a list in Java?

Vivek Verma

Vivek Verma

Updated on 26-May-2025 20:02:38

6K+ Views

In Java if you try to print a List (or any) object directly using the print statement a hash-code of the object will be printed (default behaviour). If you want to print each element of your object (such as List, Array, etc.) or perform any operation on them one by ... Read More

How to search in a List of Java object?

Vivek Verma

Vivek Verma

Updated on 26-May-2025 20:01:00

4K+ Views

A List is a sequence of elements of similar data types, and like an array, its elements are stored at specific indices, which can be accessed and searchable through the index (i.e., starting at index 0). We can search through each element in the list and retrieve its index (or ... Read More

Advertisements