Vivek Verma has Published 113 Articles

How To Calculate Volume of Prism in Java?

Vivek Verma

Vivek Verma

Updated on 26-May-2025 19:09:12

987 Views

A Prism refers to a three-dimensional solid object which has two identical ends. A prism has two faces, which are: Top and Bottom face. Lateral face Both top and bottom faces are called bases which are identical to each other. ... Read More

Can we override a start() method in Java?

Vivek Verma

Vivek Verma

Updated on 26-May-2025 19:06:03

3K+ Views

Yes! we can override the start() method of the Thread class in Java. But, if we do so, we must call it using super.start(), which will create a new thread; otherwise, no new thread will be created, and the run() method will not execute in parallel for the other threads. Overriding ... Read More

How to get Sublist of an ArrayList using Java?

Vivek Verma

Vivek Verma

Updated on 21-May-2025 16:49:38

2K+ Views

In Java, an ArrayList is a class of the List interface, which stores elements of similar data types and can be null while creating. A sub-list is the view of a portion (or part) of an ArrayList. For example, if the given array list is {1, 2, 3, 4, 5}, then the possible sub-lists ... Read More

How to remove element from ArrayList in Java?

Vivek Verma

Vivek Verma

Updated on 20-May-2025 16:16:58

570 Views

The article will discuss different ways to remove elements from an ArrayList. Below is a list of methods that can help in removing elements from an ArrayList: Using the remove() Method of List Interface Using the remove(object) Method ... Read More

How to check if ArrayList contains an item in Java?

Vivek Verma

Vivek Verma

Updated on 19-May-2025 15:27:41

5K+ Views

To check if an ArrayList contains a specific item, we can either compare each element with the given item and print the result if they are equal, or use a predefined method that directly checks for the containing element. ArrayList in Java In Java, an ArrayList is a class similar ... Read More

How to get the first element of the List in Java?

Vivek Verma

Vivek Verma

Updated on 19-May-2025 14:44:54

22K+ Views

A list stores a sequence of elements of a similar type. Like an array, the elements in a List are stored at specific indices, starting from index 0. The 0th index indicates the "first element", the 1st indicates the "second" element, and so on. In Java, a list is represented ... Read More

How to find an element in a List with Java?

Vivek Verma

Vivek Verma

Updated on 16-May-2025 19:20:46

24K+ Views

In Java, a List is an interface that extends the Collection interface and represents a sequence of elements. Since the List is an interface. To create a List object, we need to instantiate a class that implements the List interface, such as ArrayList.  The List provides various methods that ... Read More

Importance of XOR operator in Java?

Vivek Verma

Vivek Verma

Updated on 14-May-2025 19:35:13

12K+ Views

Bitwise XOR (exclusive or) "^" is an operator in Java that provides the answer '1' if both of the bits in its operands are different; if both of the bits are the same, then the XOR operator gives the result '0'. XOR is a binary operator that is evaluated from ... Read More

Will a finally block execute after a return statement in a method in Java?

Vivek Verma

Vivek Verma

Updated on 14-May-2025 19:25:38

20K+ Views

Yes, the finally block will be executed even after a return statement within a try or catch block in a Java method. Finally Block after the Return Statement Usually, the return statement will be the last in a Java method. If you try to add any statements after the return ... Read More

How to convert an OutputStream to a Writer in Java?

Vivek Verma

Vivek Verma

Updated on 14-May-2025 19:09:21

2K+ Views

Input and output Streams in Java are objects that accepts sequence of information and sends them further. These are used to read and write data from/to various sources.What are Output Streams & WritersA Java output streams accept output data (bytes) from a source and sends it to the destination. An ... Read More

Advertisements