Skip to content

Tag Archives: Java-Arrays

Multidimensional arrays in Java are common and can be termed as an array of arrays. Data in a two-dimensional array in Java is stored in… Read More
Sorting an array can be done by using inbuilt sort function while for the insertion we have to create a new array to do so… Read More
In java, the arrays are immutable i.e if the array is once assigned or instantiated the memory allocated for the array can’t be decreased or… Read More
Given two arrays, the task is to merge or concatenate them and store the result into another array. Examples: Input: arr1[] = { 1, 3,… Read More
Given two given arrays of equal length, the task is to find if given arrays are equal or not. Two arrays are said to be… Read More
Prerequisite – Different ways to create objects in Java Java programming language is all about classes and objects as it is an object-oriented programming language.… Read More
Strings are defined as an array of characters. The difference between a character array and a string is the string is terminated with a special… Read More
Data structure is a way of storing and organising data efficiently such that the required operations on them can be performed efficiently with respect to… Read More
Given a 2d array arr in Java, the task is to print the contents of this 2d array. Method 1: Loop method The first thing… Read More
Given an array arr[] of N elements, the task is to check whether the array have all same (identical) elements or not without using the… Read More
Given task is to read a matrix from the user. The size and number of elements of matrices are to be read from the keyboard.… Read More
The toArray() method of ArrayList is used to return an array containing all the elements in ArrayList in the correct order. Syntax: public Object[] toArray()… Read More
Given an array, the task is to check whether a certain element is present in this Array or not, in Java.Examples:   Input: arr[] = [5,… Read More
Given an array and a key, the task is to remove all occurrences of the specified key from the array in Java. Examples: Input: array… Read More
Reversing an array in java can be done in three simple methods.Examples:  Input : 1, 2, 3, 4, 5 Output :5, 4, 3, 2, 1… Read More