
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 7442 Articles for Java
612 Views
ArrayLists in Java are a dynamic array whose size can grow or shrink as elements are added or deleted from it. It is a part of the java.util package and is a very commonly used collection. An ArrayList is pretty much like an array as it stores elements of the same or homogeneous type in a contiguous block of memory. In this article, we are going to see the different ways to empty an ArrayList in Java. There are mainly 4 approaches to empty an ArrayList in Java and are as follows − Using the Naïve ... Read More

2K+ Views
Natural numbers are all positive integers or whole numbers that range between 1 to infinity. In this article, we will see how to find the sum of the first N natural numbers in Java, where N is the integer up to which we need to add all the numbers starting from 1. Example Scenario: Input: num = 5 Output: sum = 15 sum = 1 + 2 + 3 + 4 + 5 Using a for loop In this approach, initialize a variable with 0 to store the sum. Then, run a for loop that goes from ... Read More
1K+ Views
In this article, we are going to see how to display Floyd’s Triangle using Java. Floyd's triangle is a popular right-angled triangular array consisting of natural numbers. 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. The first row contains only 1 number which is 1 itself and each subsequent row contains 1 more number than the previous row. The triangle has n rows where n can be any positive whole number. The total number of values in ... Read More
819 Views
In programming, functions often require parameters to be passed to them 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 understand these concepts ... Read More

983 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

843 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

189 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

1K+ 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

2K+ 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

3K+ 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