Found 9150 Articles for Object Oriented Programming

Find Maximum Element in Each Row of a Matrix in Java

Mr. Satyabrata
Updated on 04-May-2023 13:56:46

2K+ 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. Here we have given a matrix which contains set of elements and as per the problem statement we have to find out the maximum element in each row of that 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-1Given matrix = 21 22 23 24 25 26 27 28 29 Maximum element in ... Read More

Find Largest & Smallest Element in Each Column of a Matrix in Java?

Mr. Satyabrata
Updated on 04-May-2023 13:54:27

1K+ 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. Here we have given a matrix which contains set of elements and as per the problem statement we have to find out the largest and smallest element in each column of that 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-1Given matrix = 21 22 23 24 25 26 27 28 29 ... Read More

Find Largest & Smallest Element in Primary and Secondary Diagonal of a Matrix in Java

Mr. Satyabrata
Updated on 04-May-2023 13:50:28

547 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. Here we have given a matrix which contains set of elements and as per the problem statement we have to find largest and smallest element in primary and secondary diagonal 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-1Given matrix = 21 22 23 24 25 26 27 28 29 ... Read More

Check if a Point Exists in Circle Sector in Java

Mr. Satyabrata
Updated on 04-May-2023 13:42:45

413 Views

A circle is a closed shape formed by tracing a point that moves in a plane such that its distance from a given point is constant. In this article we will check how to form the equation of circle from given radius and centre. We will be given a circle with point i.e (x, y), radius r and centre i.e (x1, y1). We need to form the equation of circle from given radius and centre. The equation of the circle is given by formula − $$\mathrm{(x\:-\:x1)^2\:+\:(y\:-\:y1)^2\:=\:r^2}$$ Where, (x, y) is a point. (x1, y1) is centre. And r ... Read More

Java Program for Decimal to Binary Conversion

Shriansh Kumar
Updated on 02-May-2023 18:58:58

5K+ Views

The number system is of four types: Binary, Octal, Decimal and Hexadecimal with base value 2, 8, 10 and 16 respectively. The base value depends on the number of digits contained by number system. For example, hexadecimal number system contains 16 digits i.e. 0 to 9 and A to F. Hence, its base is 16. In this article, we will discuss the binary and decimal number systems. Also, we will make java programs to convert decimal to binary numbers. Binary and Decimal number system Binary number system Binary number system works in the form of 0s and 1s. Since ... Read More

Java Program for Reversal algorithm for right rotation of an array

Shriansh Kumar
Updated on 07-Jan-2025 18:53:59

324 Views

An array is a linear data structure that stores a group of elements with similar datatypes, in a sequential order. Once we create an array, we can’t change its size, i.e., it can store a fixed number of elements. In this article, we will learn how to write a Java program where we create an array and perform the right rotation using the reversal algorithm. Right Rotation of an Array Let’s understand the term right rotation in the context of an array. In the right rotation of an array, we simply shift the elements of the array to our right till the specified number ... Read More

Java public static void main(String[] args)

Shriansh Kumar
Updated on 19-Jun-2025 11:48:14

9K+ Views

The Java program starts execution when the JVM calls the main() method. A Java application begins with this method. Without a main() method, a Java file will compile successfully because at compile time, the compiler doesn't check for a main method, but at run time JVM checks whether the main() method is available or not. Therefore, we will get an exception at run time. In this article, we will understand why we follow the convention "public static void main(String[] args)." The Syntax of a basic Java program looks like: public class class_name { // This line must be ... Read More

Java Program for Int to Char Conversion

Shriansh Kumar
Updated on 19-Jun-2025 12:04:26

353 Views

The given task is to write a Java program that converts an integer into a character. The int and char are primitive datatypes of Java. The int is a 32-bit signed datatype used to store whole numbers, and char holds 16-bit unsigned Unicode characters. The int and char keywords are used to declare an integer variable and a character variable, respectively. We store character variables in a single quotation (' '). Example Scenario To understand the problem statement, let's see an example scenario: Input: int num1 = 83; Output: ch = 'S' Here, num1 is the name of a ... Read More

Java Program for Rotate the Matrix Right by K times

Shriansh Kumar
Updated on 19-Jun-2025 12:11:27

658 Views

Array is a linear data structure that is used to store a group of elements with similar data types. It stores data in a sequential manner. When we create an array of two dimensions, i.e., rows and columns, we call it a matrix. In this article, we will create a matrix of M x N and try to rotate it right by K times. Here, M and N are the size of the row and column, respectively. K is the number of times we want to rotate the matrix. Example Scenarios Let's understand what matrix rotation is with the following ... Read More

Java Nested Loops with Examples

Shriansh Kumar
Updated on 18-Jun-2025 19:09:16

2K+ Views

Loops in Java are called control statements because they decide the flow of execution of a program based on some condition. Java allows the nesting of loops. When we put a loop within another loop, then we call it a nested loop. Nested loops are used when we need to iterate through a matrix array and when we need to do any pattern-based questions. In this article, we are going to learn about Java nested loops with examples. Nested Loops in Java We can create nested loops for the following control statements in Java: ... Read More

Advertisements