Articles on Trending Technologies

Technical articles with clear explanations and examples

Java Program to Compute the Running Total of a List

Shriansh Kumar
Shriansh Kumar
Updated on 30-Jul-2024 1K+ Views

A running total (also known as an accumulated total) of a list represents the sum of a sequence of elements. As new elements are added to the sequence, the running total continuously updates. To perform this operation in Java, we can use for loop and while loop in our program. The program will have a time complexity of O(n), where n is the number of elements in the list because it loops through the list once and performs a constant-time operation for each element in the list. List is an interface of Java Collection Framework that stores collections of objects. ...

Read More

Java Program to Create a Matrix and Fill it With Prime Numbers

Shriansh Kumar
Shriansh Kumar
Updated on 30-Jul-2024 861 Views

As per the problem statement, we have to create an empty matrix and fill that matrix with the prime numbers starting from the smallest prime number i.e. 2. A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. For instance, let's take the number 7. When we divide 7 by any number other than 1 and 7, we get a remainder. For example, dividing 7 by 2 gives a remainder of 1, and dividing 7 by 3 gives a remainder of 1 as well. Therefore, 7 has no divisors other ...

Read More

Difference Between Maskable and Non-Maskable Interrupt

Shirjeel Yunus
Shirjeel Yunus
Updated on 26-Jul-2024 2K+ Views

Interrupt is an issue that is not caused by the CPU but is done by a component. Interrupts may occur suddenly and CPU has to take immediate action to resolve the issue. Interrupts are of many types and in this article, we will discuss the difference between Maskable and Non-Maskable Interrupts. What is Maskable Interrupt? Maskable interrupt is a kind of interrupt which can be ignored or disabled by instructions given by the CPU. The ignoring or disabling of this interrupt allows the system to give priority to certain tasks. The sources of interrupts are also disabled so that critical ...

Read More

Difference Between Membrane Keyboard and Mechanical Keyboard

Shirjeel Yunus
Shirjeel Yunus
Updated on 26-Jul-2024 201 Views

A keyboard is an input device which is used in computers and typewriters to type different types of alphabets, numerals, and symbols. In the case of computers, the characters typed through the keyboard are visible on the screen. Previously, keyboards were used only for typing but now games can also be played. Keyboards are of many types and in this article, we will discuss the difference between mechanical and membrane keyboards. What is a Membrane Keyboard? A membrane keyboard consists of three layers of membrane. The location of each key is different on the three-layered membrane. The membrane is sensitive ...

Read More

How to Automatically Resolve Git Merge Conflicts in Favor of Any Side?

Git
Dm. Mehedi Hasan Abid
Dm. Mehedi Hasan Abid
Updated on 25-Jul-2024 904 Views

As a developer, you probably love coding but dread the inevitable merge conflicts that come with Git. These conflicts can disrupt your flow and waste precious time. Fortunately, there's a way to automate the resolution process, ensuring you can keep working smoothly. In this article, I'll show you how to set up automatic conflict resolution in Git, favoring either your changes or those from another branch. My First Encounter with Merge Conflicts I remember my first major merge conflict like it was yesterday. I had just finished a big feature and was excited to merge my branch. Instead of celebrating, ...

Read More

Java program to display previous month from GregorianCalendar

Samual Sam
Samual Sam
Updated on 25-Jul-2024 3K+ Views

The GregorianCalendar class in Java allows us to manipulate dates and times easily. In this example, we will create a GregorianCalendar object and use it to display the current date and the date of the previous month. Problem Statement Write a Java program and create a GregorianCalendar object, display the current date, and then modify this date to show the date of the previous month. Output Current date: Mon Nov 19 18:07:03 UTC 2018 Input Modified date (Previous Month): Fri Oct 19 18:07:03 UTC 2018 Steps to display previous month from GregorianCalendar Below are the steps to display previous ...

Read More

Java program to find maximum odd number in array using stream and filter

Shiva Keerthi
Shiva Keerthi
Updated on 25-Jul-2024 2K+ Views

In this section, we are going to write a Java program to find maximum odd number in an Array using Stream and Filter. Odd numbers are the numbers which cannot be divided by 2 or these numbers give remainder as 1 when they are divided by 2. In other terms which can be written in the form of 2n+1. We will find the maximum odd number in the array. Problem Statement Write a program in Java to find maximum odd number in array using stream and filter − Input array = {1, 7, 2, 3, 9, ...

Read More

Java Program to Save a String to a File

Rudradev Das
Rudradev Das
Updated on 24-Jul-2024 3K+ Views

String, the series of characters, used in Java programming enable to save memory consumption and boost the performance. We can save a string to a file using Java program can be initiated in multiple ways and has been introduced in Java version 11. Four parameters can be used to save a string to a file using Java. They are the file path, character sequence, charset, and options. File path and character sequence, these two are the most important and mandatory for this approach to write into a file. This technique encodes the characters as the content, and it returns the ...

Read More

Java program to replace a word with asterisks in a sentence

AmitDiwan
AmitDiwan
Updated on 24-Jul-2024 3K+ Views

In this article, we will learn how to replace a specific word in a sentence with asterisks using Java. This technique can be useful for obscuring certain words in a text for privacy or censorship purposes. Problem Statement Develop a program in Java that takes a sentence and a word to be censored as input, then outputs the sentence with the specified word replaced by asterisks, while preserving the original format of the sentence. Input This is a sample only, the sky is blue, water is transparent Output This is a ****** only, the sky is blue, water is transparent ...

Read More

Java program to reverse an array in groups of given size

Samual Sam
Samual Sam
Updated on 24-Jul-2024 3K+ Views

An array can be reversed in groups of a given size by reversing the subarrays of the required size. In the given article, the program demonstrates a technique for reversing an array in groups of a specified size. This technique is useful in various computational tasks and algorithm design. The program takes an array and a group size as input and reverses the array in groups of that size. The original and modified arrays are then printed to the console. Problem Statement Write a Java program to reverse an array in groups of a given size. An example of ...

Read More
Showing 32091–32100 of 61,297 articles
Advertisements