Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Determine and explain the output from the following code: public class MyClass { public static void main(String args[]) { int [] a = new int
Determine and explain the output from the following code:
public class MyClass { public static void main(String args[]) { int [] a = new int [10]; int[] b = new int [10]; a [3] =7; b[3] =7; System.out.println(a.equals(b)); } }
I am getting a false output. Which I believe is incorrect and it should be true? I understand we are not using inheritance, but it seems that the code is placing the number 7 in the same place in both arrays, which should make it equal? Or must you have something like a=b in order for it to be equal?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started