Found 7442 Articles for Java

Find Scalar Multiplication of a Matrix in Java?

Mr. Satyabrata
Updated on 06-Mar-2023 11:23:01

715 Views

In Java, Array is an object. It is a non-primitive data type which stores values of similar data type. The matrix in java is nothing but a multi-dimensional array which represents multiple rows and columns. Scalar multiplication is nothing but multiplication between a matrix and a real number. The result of this multiplication is in matrix format. As per the problem statement, we have to find the scalar multiplication of a matrix. Let’s deep dive into this article, to know how it can be done by using Java programming language. To show you some instances Instance-1 Suppose the original matrix ... Read More

Find index of 0 or Any Negative Integer Element Present in Array in Java

Mr. Satyabrata
Updated on 06-Mar-2023 11:16:29

786 Views

As per the problem statement, we have given an array with some random integer values and we have to find out and print the index which contains any zero or negative values. Note - Take an integer array Let’s deep dive into this article, to know how it can be done by using Java programming language. To show you some instances Instance-1 Given Array= [1, 2, -3, -4, 0, 5] The index contains Zero and negative values = 2, 3, 4 Instance-2 Given Array= [-1, 0, 4, 6, 8, -5] The index contains Zero and negative values = 0, 1, ... Read More

Find Array Elements Which are Greater than its Left Elements in Java?

Mr. Satyabrata
Updated on 01-Mar-2023 12:24:32

493 Views

An array is a linear data structure in which elements are stored in contiguous memory locations. As per the problem statement, we have given an array with some random integer values and we have to find out the numbers which are greater than its all left elements by using Java programming language. Let’s start! To show you some instances Instance-1 Given Array= [1, 2, -3, -4, 0, 5]. The numbers which are greater than its all left elements = 2, 5 Instance-2 Given Array= [-1, 0, 4, 6, 8, -5]. The numbers which are greater than its all left ... Read More

Find Array Elements Which are Greater Than Its Immediate Left Element?

Mr. Satyabrata
Updated on 01-Mar-2023 11:42:26

1K+ Views

As per the problem statement, we have an array with some random integer values and we need to find out the numbers which are greater than its immediate left element. Note - Take an integer array. Let’s deep dive into this article, to know how it can be done by using Java programming language. To show you some instances Instance-1 Given Array= [1, 2, -3, -4, 0, 5]. The numbers which are greater than its left element = 2, 0, 5 Instance-2 Given Array= [-1, 0, 4, 6, 8, -5]. The numbers which are greater than its left element = ... Read More

Find All Possible Coordinates of a Parallelogram in Java?

Mr. Satyabrata
Updated on 01-Mar-2023 11:40:21

385 Views

A parallelogram refers to the quadrilateral which has two pairs of parallel sides where opposite sides are equal in length, and the opposite angles are equal in measure. In this article we are going to find all possible coordinates of a Parallelogram. Basically, we will find all the possible coordinates from the given three coordinates to make a parallelogram of a non-zero area. Here the three given coordinates are not fixed points and can change. Therefore, if three coordinates are given, we may claim that there are only three coordinates from which we can build a parallelogram. As per ... Read More

Convert All Lowercase Text of a File into Uppercase in Java?

Mr. Satyabrata
Updated on 01-Mar-2023 11:31:16

3K+ Views

In this article we are going to change all lower-case text to upper-case text in a file in java. Suppose the text file contains the following data − “Merry and Jack are studying.” Then after updating the text file with specific value the result will be − “MERRY AND JACK ARE STUDYING.” This modification is done with the help of toUpperCase() Method. It belongs to the String class in java. Let’s deep dive into this article, to know how it can be done by using Java programming language. To show you some instances Instance-1 Suppose the original content of the ... Read More

Should we declare it as Queue or Priority Queue while using Priority Queue in Java?

Sonal Meenu Singh
Updated on 22-Feb-2023 15:37:35

249 Views

Introduction The queue is a linear data structure that follows the FIFO approach to insert and extract its data. A priority Queue is a structured Queue, where all data have some priorities for their processing. In Java, a queue or priority queue is an interface. In this tutorial, we will examine whether we should declare a queue or priority queue as a Priority Queue in Java. Queue A Queue in Java is an interface and that interface belongs to java.util package. The queue interface extends the Collection Interface and this interface has several methods. Queue uses FIFO (First In First ... Read More

How to implement size-limited Queue that holds last N elements in Java?

Sonal Meenu Singh
Updated on 22-Feb-2023 11:58:17

1K+ Views

Introduction A queue is an interface in Java. It is used to insert elements at one end and remove them from another end. It uses the FIFO principle for its processing. The queue extends the Collection framework and is defined in the Java.util interface. In this tutorial, we will understand the implementation of size limited queue in Java. What is Size Limited Queue in Java? A size-limited queue is a queue with a fixed size of N. It cannot hold elements more than its size. If you try to push more data, it will remove elements from its front ... Read More

Difference Between Priority Queue and Queue Implementation in Java?

Sonal Meenu Singh
Updated on 22-Feb-2023 11:42:58

3K+ Views

The queue is a linear data structure that inserts elements from the back and removes elements from the starting end of the queue. A priority queue is an extended version of the normal queue with priorities for each element. In this tutorial, we learn about the queue and priority queue in Java with individual implementation. Difference between Priority Queue and Queue in Java Area Priority Queue Queue Definition A priority queue is the queue in which each of its elements has some priorities. The elements from the queue are removed based on their priorities. Queue is ... Read More

Difference Between add() & offer() methods in Queue in Java?

Sonal Meenu Singh
Updated on 22-Feb-2023 11:33:05

3K+ Views

Queue in Java is a linear data structure with various functions. A Queue has two endpoints and it follows the First-In-First-Out (FIFO)principle to insert and remove its elements. In this tutorial, we will look at two important functions of the queue in Java and they are add() and offer(). What is Queue? A queue in java is an interface that extends the util and collection packages. The elements are inserted at the Rear end and removed from the Front end. A queue in java can be implemented by using the classes of linked list, DeQueue, and priority queue. A priority ... Read More

Advertisements