Java Program to find the sum of each row and each column of a matrix17 Mar 2025 | 2 min read In this program, we need to calculate the sum of elements in each row and each column of the given matrix. ![]() Above diagram shows the sum of elements of each row and each column of a matrix. Algorithm
ProgramOutput: Sum of 1 row: 6 Sum of 2 row: 15 Sum of 3 row: 24 Sum of 1 column: 12 Sum of 2 column: 15 Sum of 3 column: 18 Next TopicJava Programs |
In this program, we will find out the largest node in the given binary tree. We first define variable max that will hold root's data. Then, we traverse through the left sub-tree to find the largest node. Compare it with max and store the maximum...
5 min read
It is a problem frequently asked in interviews of top IT companies like Google, Amazon, TCS, Accenture, etc. By solving the problem, one wants to check the logical ability, critical thinking, and problem-solving skill of the interviewee. So, in this section, we are going to discuss...
4 min read
Java Object class is the super class of all the Java classes. All Java classes implements the Object class by default. The Java Object class provides the two important methods to compare two objects in Java, i.e. equals() and hashCode() method. While Java provides built-in...
5 min read
Bubble Sort is one of the simplest sorting algorithms, primarily used for educational purposes due to its ease of implementation and understanding. Despite its simplicity, it's not the most efficient sorting algorithm for large datasets. However, comprehending Bubble Sort provides a foundational understanding of sorting...
6 min read
In this program, we will create a singly linked list and delete a node from the beginning of the list. To accomplish this task, we need to make the head pointer pointing to the immediate of the initial node which will now become the...
6 min read
We can reverse each word of a string by the help of reverse(), split() and substring() methods. By using reverse() method of StringBuilder class, we can reverse given string. By the help of split("\\s") method, we can get all words in an array. To get...
1 min read
Java Convert Hexadecimal to Decimal We can convert hexadecimal to decimal in java using Integer.parseInt() method or custom logic. Java Hexadecimal to Decimal conversion: Integer.parseInt() The Integer.parseInt() method converts string to int with given redix. The signature of parseInt() method is given below: public static int parseInt(String s,int redix) Let's see...
2 min read
Java Program to transpose matrix Converting rows of a matrix into columns and columns of a matrix into row is called transpose of a matrix. Let's see a simple example to transpose a matrix of 3 rows and 3 columns. public class MatrixTransposeExample{ public static void main(String args[]){ //creating a matrix int...
3 min read
Java Convert String to int We can convert String to an int in java using Integer.parseInt() method. To convert String into Integer, we can use Integer.valueOf() method which returns instance of Integer class. Scenario It is generally used if we have to perform mathematical operations on the string which...
2 min read
Program to print smallest and biggest possible palindrome word in a given string In this program, we need to find the smallest and biggest palindromic word present in the given string. Wow you own kayak In above example, wow represent the smallest palindrome and kayak represent the biggest...
3 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India