Java | Arrays | Question 6

Output of following Java program?

filter_none

edit
close

play_arrow

link
brightness_4
code

class Test
{
    public static void main (String[] args) 
    {
        int arr1[] = {1, 2, 3};
        int arr2[] = {1, 2, 3};
        if (arr1 == arr2) 
            System.out.println("Same");
        else
            System.out.println("Not same");
    }
}

chevron_right


(A) Same
(B) Not Same


Answer: (B)

Explanation: See https://www.geeksforgeeks.org/compare-two-arrays-java/

Quiz of this Question



My Personal Notes arrow_drop_up


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.