Found 9326 Articles for Object Oriented Programming

Java Program to Display Floyd's Triangle

Pranay Arora
Updated on 10-Mar-2023 11:20:42

473 Views

Floyd's triangle is a popular right-angled triangular array consisting of natural numbers. The name comes from its founder Robert W. Floyd who was a prominent computer scientist. It is formed by starting with the number 1 at the top of the triangle, and then incrementing each subsequent number by 1 as you move down the rows of the triangle. In this article, we are going to see how to display Floyd’s Triangle with the help of a Java program. But before going forward with the Java implementation, let us understand Floyd’s triangle a little more. The first row ... Read More

Java Program to Demonstrate the Call By Value

Pranay Arora
Updated on 10-Mar-2023 11:16:53

326 Views

In programming, functions often require parameters to be passed to them in order to be called or invoked. There are 2 ways to call functions, the 1st being call by Reference and the 2nd being call by value. In this article, we are going to demonstrate call by value in java. Call by value is a method in which the value of the argument is passed as a copy to the function, hence any change made to this argument inside the function will not affect the original value of the argument beyond the scope of this function. To help ... Read More

How to send button value to PHP backend via POST using ajax?

Mohit Panchasara
Updated on 10-Mar-2023 16:56:27

2K+ Views

AJAX (Asynchronous JavaScript and XML) makes web pages more responsive, interactive, and dynamic by enabling server communication without requiring a page to load. JavaScript is used to send and receive data from a server using various technologies, including XML, JSON, and HTML. In these, JSON is the most popular. AJAX is frequently used to transmit information from a web page to a server-side script, like a PHP script. The XMLHttpRequest object, included in most contemporary web browsers, can be used for this. You can establish a connection to a given URL, send data to that URL, and then wait ... Read More

Rotate the matrix 180 degree in Java?

Mr. Satyabrata
Updated on 09-Mar-2023 12:13:59

531 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. As per the problem statement we have to rotate the given matrix to 180 degrees. It means we have to interchange the rows of the given matrix in symmetric- vertically. 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 is { {10, 20, ... Read More

Replace the Matrix Elements by Its Square in Java?

Mr. Satyabrata
Updated on 09-Mar-2023 12:07:03

569 Views

Matrices are nothing but it’s more than a collection of data elements arranged in a rectangular layout that is two-dimensional. In Java, an array with two dimensions can be considered as a matrix. As per the problem statement the task is replace the matrix elements by its square. 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 is {{8, 3, 2}, {12, 7, 9}, {6, 4, 10}}; After replacing the matrix element by its square, the result matrix will be 64 ... Read More

How to Homogenize a Point in Java?

Mr. Satyabrata
Updated on 09-Mar-2023 11:59:15

130 Views

In this article we will see how to homogenize a point. Any point in the projective plane is represented by a triple (X, Y, Z), called homogeneous coordinates or projective coordinates of the point, where X, Y and Z are not all 0. The point represented by a given set of homogeneous coordinates is unchanged if the coordinates are multiplied by a common factor. As per the problem statement we have to homogenize a point by taking any common factor and multiplying it with the given points. Let’s start! To show you some instances Instance-1 Suppose the points are (10, ... Read More

How to Get File Owner’s Name in Java?

Mr. Satyabrata
Updated on 09-Mar-2023 12:02:15

747 Views

As per the problem statement, we are going to find the file owner name in Java. The owner’s name here represents the owner of the PC in which file is being runned. To find the file owner in Java we will use the getOwner() method of the FileOwnerAttributeView class. FileOwnerAttributeView belongs to the java.nio class. 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 given file location is “D:/saket.txt”. After checking for Owner name of the given file, the output will be − ... Read More

How to Get a List of Current Open Processes Java?

Mr. Satyabrata
Updated on 04-Apr-2023 12:14:06

1K+ Views

It is essential for the user to know about the processes that are running in their system, be it foreground or background. To do so in windows we have a task manager but internally it uses a program called tasklist. Tasklist aside from giving us the currently running processes, it also gives us details like process id, session name, session and memory usage of each process. In this article we will see how we can get a list of currently open processes by using Java programming language. Algorithm Step 1 − Create a process that executes the tasklist.exe Step 2 ... Read More

How to Find Single Digit Array Elements in Java?

Mr. Satyabrata
Updated on 09-Mar-2023 11:21:50

2K+ Views

In a given array with some random integer values, we have to find out the single digits available in the given array and print those single digit values as output. An array can contain positive or negative numbers irrespective of the number of digits in a number. As here all elements belong to numeric type. Note- Take a positive 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, 12, 3, 4, 10, 15]. The single digit elements present in the ... Read More

Find Number of Sorted Rows in a Matrix in Java?

Mr. Satyabrata
Updated on 06-Mar-2023 17:26:21

278 Views

Matrices are nothing but a collection of data elements arranged in a rectangular layout that is two-dimensional. In Java, an array with two dimensions can be considered as a matrix. As per the problem statement the task is to count all the rows in a matrix that are sorted either in strictly increasing order or in strictly decreasing order. 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 is{ { 5, 6, 7, 8 , ... Read More

Advertisements