Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.image text in transcribedprintln("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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Azure SQL Database For Modern Developers Building Applications In The Microsoft Cloud

Authors: Davide Mauri, Silvano Coriani, Anna Hoffma, Sanjay Mishra, Jovan Popovic

1st Edition

1484263693, 978-1484263693

More Books

Students also viewed these Databases questions