Skip to content

Tag Archives: Java-Arrays

Prerequisite: Arrays in Java A jagged array is an array of arrays such that member arrays can be of different sizes, i.e., we can create… Read More
Given an array, we need to copy its elements in a different array, to a naive user below way comes into mind which is however… Read More
class Test {     public static void main (String[] args)      {         int arr1[] = {1, 2, 3};         int arr2[] = {1, 2, 3};         if (arr1.equals(arr2))             System.out.println("Same");… Read More
Output of following Java program? import java.util.Arrays; class Test {     public static void main (String[] args)      {         int arr1[] = {1, 2, 3};         int arr2[]… Read More
Output of following Java program? class Test {     public static void main (String[] args)      {         int arr1[] = {1, 2, 3};         int arr2[] = {1,… Read More
public class Main {     public static void main(String args[]) {         int arr[][] = new int[4][];         arr[0] = new int[1];         arr[1] = new int[2];         arr[2] =… Read More
class Test {    public static void main(String args[]) {      int arr[] = new int[2];        System.out.println(arr[0]);      System.out.println(arr[1]);    } } (A) 0 0 (B) garbage value garbage… Read More
class Test {    public static void main(String args[]) {      int arr[2];        System.out.println(arr[0]);      System.out.println(arr[1]);    } } (A) 0 0 (B) garbage value garbage value (C) Compiler… Read More
While comparing two arrays we can not use “==” operator as it will compare the addresses of the memory block to which both the arrays… Read More
Predict the output? // file name: Main.java public class Main {     public static void main(String args[]) {        int arr[] = {10, 20, 30, 40, 50};… Read More
Which of the following is FALSE about arrays on Java (A) A java array is always an object (B) Length of array can be changed… Read More
As we all know final variable declared can only be initialized once whereas the reference variable once declared final can never be reassigned as it… Read More

Start Your Coding Journey Now!