Question: Question 2 is based on code given below: class arrassignment { public static void main (String[] args) { int arr1[ ] = {34, 54, 90,

Question 2 is based on code given below: class arrassignment { public static void main (String[] args) { int arr1[ ] = {34, 54, 90, 45, 89, 42, 88, 22, 19, 49}; int arr2[ ] = {34, 54, 90, 45, 89, 42, 88, 22, 19, 49}; if (arr1 == arr2) System.out.Question 2 is based on code given below: class arrassignment { publicprintln("Same"); else System.out.println("Not same"); arr1 = new int[5]; System.out.println("arr1[4] is " + arr1[4]); System.out.println("arr2[4] is " + arr2[4]); } a) What will be the output for this code? Justify why is your output is in such a way. b) So how many ways are there to solve the issue on if(arr1==arr2)? Explain all the solutions. c) How many ways are there to copy an array from another array? Explain all the ways mentioned and justify your answers with examples

2. 2. Question 2 is based on code given below: class arrassignment public static void main (String[] args) int arrit 1 = 134, 54, 90, 45, 89, 42, 88, 22, 19, 49); int arr21 - {34, 54, 90, 45, 89, 42, 88, 22, 19, 49); if (arri = arr2) System.out.printin ("Same"); else System.out.println("Not same"); arrl - new int[5]; System.out.println("arri[4] is " + arri[4]); System.out.println("arr2[4] is " + arr2[4]); a) What will be the output for this code? Justify why is your output is in such a way. b) So how many ways are there to solve the issue on if (arri==arr2)? Explain all the solutions. c) How many ways are there to copy an array from another array? Explain all the ways mentioned and justify your answers with examples. (10 marks)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!