Vivek Verma has Published 113 Articles

Compiling a C++ program with GCC

Vivek Verma

Vivek Verma

Updated on 28-Aug-2025 15:43:45

31K+ Views

To compile a C++ program with GCC, we need to download GCC or install the g++ compiler on our system. Otherwise, you will not be able to compile C++ code using GCC. What is GCC? The GCC is a tool chain that compiles code. It stands for GNU Compiler ... Read More

Can we synchronize a run() method in Java?

Vivek Verma

Vivek Verma

Updated on 28-Aug-2025 14:46:52

3K+ Views

Yes, we can synchronize a run() method in Java using the synchronized keyword before this method. If this method is synchronized, only one thread can execute this on a given instance of the object at any point in time. Here is a code snippet that shows how to define the ... Read More

132 Pattern in C++

Vivek Verma

Vivek Verma

Updated on 28-Aug-2025 14:10:10

459 Views

The 132 pattern indicates that, as the digits in "132" in any given value, the middle element should be greater than the last and first elements. Similarly, the last element must be greater than the first element. To check 132 patterns in C++, we will use the Array data structure. We ... Read More

Add elements to a Set using Javascript

Vivek Verma

Vivek Verma

Updated on 24-Jul-2025 15:31:09

214 Views

In JavaScript, a Set is an object that is used to store a collection of unique elements of different types, such as numbers, strings, booleans, and object references, etc. const mySet = new Set(); Adding Elements to a JavaScript Set We can add elements to a JavaScript set in ... Read More

Add a method to a JavaScript object constructor?

Vivek Verma

Vivek Verma

Updated on 24-Jul-2025 11:26:03

3K+ Views

In JavaScript, adding a method (function) to a constructor is different from adding a method to a regular object. To add a method to a constructor, we need to define it inside the constructor or in its prototype (using which JavaScript objects inherit features from one another). We can create ... Read More

How can we Implement a Stack using Queue in Java?

Vivek Verma

Vivek Verma

Updated on 22-Jul-2025 12:42:53

1K+ Views

This article will discuss how to implement a Stack using a Queue in Java.  Stack in Java In Java, a Stack is a subclass (child class) of the Vector class, and it represents a LIFO stack of objects, which stands for Last-in-First-Out. The last element added at the top of ... Read More

How can we Implement a Queue using Stack in Java?

Vivek Verma

Vivek Verma

Updated on 22-Jul-2025 11:44:33

2K+ Views

This article will discuss how to implement a Queue using a Stack in Java. It will briefly introduce the Queues and Stacks, and provide a suitable example that shows their implementation. Queues in Java In Java, the Queue class extends the Collection interface, and it supports the insert and remove operations ... Read More

# and ## Operators in C ?

Vivek Verma

Vivek Verma

Updated on 12-Jul-2025 23:12:11

3K+ Views

In C, the "#" and "##" are the pre-processor operators that are used to convert a macro parameter to a String Literal. The macro parameters are the parameters of the macro definition, which are declared using the #define directive. The "#" operator is known as the Stringize operator, whereas ... Read More

How to make a singleton enum in Java?

Vivek Verma

Vivek Verma

Updated on 23-Jun-2025 12:13:12

3K+ Views

In Java, an enum is a special class used to represent a group of constants (that cannot be changed, like a final variable), such as Days: SUNDAY, MONDAY, TUESDAY, etc. Following is the syntax to create an Enum class in Java: enum ClassName { VALUE1, ... Read More

How to read the data from a properties file in Java?

Vivek Verma

Vivek Verma

Updated on 23-Jun-2025 11:31:51

34K+ Views

Java supports file-handling; it provides various classes that provide various methods to read, write, update, and delete data from files in our local system. A properties file is a simple text file with a ".properties" extension that contains configuration data in the form of key-value pairs. It is mostly used in Java ... Read More

Advertisements