Articles on Trending Technologies

Technical articles with clear explanations and examples

ConcurrentModificationException while using Iterator in Java

Rudradev Das
Rudradev Das
Updated on 17-Jun-2024 420 Views

If any particular method encountered the concurrent in a multi threaded Java environment during the resource detection then the ConcurrentModificationException might be thrown. In this process the object is a non permissible unit here. Here is an example related to the ConcurrentModificationException in Java − Exception in thread "main" java.util.ConcurrentModificationException at java.base/java.util.ArrayList$Itr.checkForComodification(ArrayList.java:000) at java.base/java.util.ArrayList$Itr.next(ArrayList.java:000) atcom.journaldev.ConcurrentModificationException.ConcurrentModificationExceptio nExample.main(ConcurrentModificationExceptionExample.java:00) For this particular process the exception is achieveable when − The exception detected and iteration is in not defined in the method. When the process blocked in a loop of fail fast iterator by using an internal flag called modCount. ...

Read More

Containerizing Java applications

Rudradev Das
Rudradev Das
Updated on 17-Jun-2024 359 Views

Containerization is a Java embedded process, which is able to pack the Java service or an application within a software container class. It includes every component which needs to execute the process within the packet. Containerized Java applications have lots of benefits with − Granullar stability − It makes the content more stable and easily scale up the value of the content. Flexibility − It develops the flexibility to enhance the experiment process. Resilience − Helps to avoid the cascading failure of an application. Cost − As the process is the embedded one, so the cost is low. ...

Read More

Convert ArrayList to HashMap in Java

Rudradev Das
Rudradev Das
Updated on 17-Jun-2024 5K+ Views

In Java the List is a child interface class which can also represents a Collection set. It is an ordered collection set, consists of the objects where duplicate values can be sorted also. Java array list is a collection framework as it presents into the java.util package and provides the dyanamic array elements in Java. For the ArrayList we do not have to mention the size of the list. On the other hand, the HashMap is a Java collection which can be found as a package in java.util. It contains the data values as a pair of (Key, Value).Basically, there ...

Read More

Convert ArrayList to LinkedHashMap in Java

Rudradev Das
Rudradev Das
Updated on 17-Jun-2024 2K+ Views

The LinkedHashMap Class is an one type of Hash Map which enables an user to maintain a systematic cronology of the elements present into it. This feature also provides the method of insertion, search and deletion in a quick manner. When we need to convert an array list to a linked hash map, we need to set a key value for this and it reflects as the index of an array list. In terms of the process of the iteration and the data sorting, array list and linked hash map; both are same in nature. Here is a general example ...

Read More

Convert byte[] array to File using Java

Rudradev Das
Rudradev Das
Updated on 17-Jun-2024 6K+ Views

The file class is a representation of directory path name in Java with different formats on different platforms. The file class contains the method of different path name which is responsible for deleting and renaming files by using the new directories. It is an abstract class in a string formation which can be either absolute or relative. Algorithm to of Convert Byte[ ] Array to File In this possible algorithm, we are going to show you how to perform a conversion process on a byte() array node to make it a file. By using this algorithm, we are going to ...

Read More

Primitive data type vs. Object data type in Java with Examples

Rudradev Das
Rudradev Das
Updated on 17-Jun-2024 1K+ Views

In a Java environment, every variable contains with some data types, which specify the value and type of a sorted identifier. There are two categories − Primitive Data type Non-Primitive Data type or Object data type The primitive data types are some predefined data types with some specific size and type. This method has some standard values with the types know as byte, short, int, long, float, double, char and boolean. When we want to run a primitive structure, then it stores the data in a stack and assign a value for the process. On the other hand, ...

Read More

Java program to find the sum of elements of an array

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 14-Jun-2024 47K+ Views

To find the sum of elements of an array.create an empty variable. (sum)Initialize it with 0 in a loop.Traverse through each element (or get each element from the user) add each element to sum.Print sum.Exampleimport java.util.Arrays; import java.util.Scanner; public class SumOfElementsOfAnArray {    public static void main(String args[]){       System.out.println("Enter the required size of the array :: ");       Scanner s = new Scanner(System.in);       int size = s.nextInt();       int myArray[] = new int [size];       int sum = 0;       System.out.println("Enter the elements of the array one by one ");       for(int i=0; i

Read More

Java program to find the GCD or HCF of two numbers

Chandu yadav
Chandu yadav
Updated on 14-Jun-2024 37K+ Views

An H.C.F or Highest Common Factor, is the largest common factor of two or more values.For example factors of 12 and 16 are −12 → 1, 2, 3, 4, 6, 12 16 → 1, 2, 4, 8, 16The common factors are 1, 2, 4 and the highest common factor is 4.AlgorithmDefine two variables - A, BSet loop from 1 to max of A, BCheck if both are completely divided by same loop number, if yes, store itDisplay the stored number is HCFExample: Using Java for loop import java.util.Scanner; public class GCDOfTwoNumbers {    public static void main(String args[]){   ...

Read More

Earth Leakage Circuit Breaker (ELCB) - How It Works

Manish Kumar Saini
Manish Kumar Saini
Updated on 10-Jun-2024 2K+ Views

Earth Leakage Circuit Breaker (ELCB) is a type of circuit breaker used in electrical circuits for providing protection against earth leakage fault. In other words, an ELCB is a protection device used to protect people from getting electric shocks in case of an earth leakage fault. The primary function of an ELCB is to detect and interrupt an electric current that leaks to the ground, which is basically the condition of earth fault. Read this article to understand the basics, working principle, types, advantages, disadvantages, and applications of Earth Leakage Circuit Breakers. What is an ELCB? Earth Leakage Circuit ...

Read More

Motor Protection Circuit Breaker (MPCB) - How It Works

Manish Kumar Saini
Manish Kumar Saini
Updated on 10-Jun-2024 2K+ Views

Motor Protection Circuit Breaker (MPCB) is a type of circuit breaker used for providing protection to electric motors. MPCBs are specially designed for protecting electric motors only. Read this article to learn the functions, working, and applications of motor protection circuit breaker (MPCB). What is an MPCB? Motor Protection Circuit Breaker is a specially designed circuit breaker used for protecting electric motors from faults or abnormal conditions. In any industry, electric motors are very important and significantly expensive devices. Therefore, they have to be protected from faults and abnormal conditions that occur in power system. For this purpose, MPCBs ...

Read More
Showing 32181–32190 of 61,297 articles
Advertisements