Question

What is the output of the following codes? Line1: public class ArrayCompare ! Line2: public static void main (String[] args)
0 0
Add a comment Improve this question Transcribed image text
Answer #1

The output is :

Not Same

These two arrays are considered as objects and arr1 and arr2 are the references to these objects.

These two references are not pointing to same object, so they are not same

Add a comment
Know the answer?
Add Answer to:
What is the output of the following codes? Line1: public class ArrayCompare ! Line2: public static...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • What is the output of the following codes? Line1: public class ArrayCompare { Line2: public static...

    What is the output of the following codes? Line1: public class ArrayCompare { Line2: public static void main (String[] args) { Line 3: int arrill {1, 2, 3}; Line 4: int arr2[1 {1, 2, 3}; Line5: if (arri == arr2) Line 6: System.out.println("Same"); Line: else Line 8: System.out.println("Not game"); Line9 : Line10:) حسین Same Not same

  • What is the output of the following codes? Line1: public class ArrayLength { Line2: public static...

    What is the output of the following codes? Line1: public class ArrayLength { Line2: public static void main(String args[]) { Line 3: int a[] = {45, 44, 39, 48, 37); Line 4: System.out.print(a.length()); Line5: Line 6: } w Compiling error Oo 05 04

  • What is the output for the following program codes? a) [ 0.5 Mark ] class A...

    What is the output for the following program codes? a) [ 0.5 Mark ] class A { int i; } class B extends A { int j; void display() { super.i = j + 1; System.out.println(j + " " + i); }} class inheritance { public static void main(String args[]) { B obj = new B(); obj.i=1; obj.j=2; obj.display(); }} OUTPUT: b) [ 0.5 Mark ] class Parent { public void getBike(){ System.out.println("Suzuki Bike"); }} class Child extends Parent {...

  • Consider the following method: Linel: public static int mystery(int n) { Line2: if (n < 10)...

    Consider the following method: Linel: public static int mystery(int n) { Line2: if (n < 10) { ine3: return n; Line4: } else { Line5: int a = n/10; Line 6: int b = n % 10; Line 7: return mystery(a + b); Line 8: } Line 9: } What is the result of the following call? System.out.println(mystery(648)); 18 8 12

  • What is the output of the following code? Explain your answer. public class Test {public static...

    What is the output of the following code? Explain your answer. public class Test {public static void main (String [] args) {System.out. print((int) 5.6); System.out.println((int) 5.2);}}

  • What is the Java output? Part One: class Driver { public static void main(String[] args) {...

    What is the Java output? Part One: class Driver { public static void main(String[] args) { int a = 5; int b = 3; if (a < b || a * 2 < b) System.out.print(a - b); System.out.print(b + a); } } Part Two: class Driver { public static void main(String[] args) { int a = 5; int b = 8; if (a < b) if (a * 2 < b) System.out.print("foo"); else System.out.print("bar"); else System.out.print("buz"); } }

  • What output is produced by the following program? public class MysteryNums public static void main(String[] args)...

    What output is produced by the following program? public class MysteryNums public static void main(String[] args) - int x = 12; int y = x - 3; 3, sentence (y, x + y); . public static void sentence (int numi, int num2) { 4: System.out.println(num1 + " + num2);

  • I need to make this code access the main method I suppose, but I don't know...

    I need to make this code access the main method I suppose, but I don't know how to make that happen... Help please! QUESTION: Write a method called switchEmUp that accepts two integer arrays as parameters and switches the contents of the arrays. Make sure that you have code which considers if the two arrays are different sizes. Instructor comment: This will work since you never go back to the main method, but if you did, it wouldn't print out...

  • import java.util.Arrays; public class lab {    public static void main(String args[])    {    int...

    import java.util.Arrays; public class lab {    public static void main(String args[])    {    int arr[] = {10, 7, 8, 9, 1, 5,6,7};    int arr2[] = {9, 8, 7, 6, 5, 4, 3, 2, 1};    int arr3[] = {1, 3, 5, 3, 2, 6, 20};    quicksort(arr,0,arr.length-1);    quicksort(arr2,0,arr2.length-1);    quicksort(arr3,0,arr3.length-1);    System.out.println(Arrays.toString(arr));    System.out.println(Arrays.toString(arr2));    System.out.println(Arrays.toString(arr3));       }    private static int partition(int[] items,int low, int high)    {    int i=0;    int j=0;...

  • (How do I remove the STATIC ArrayList from the public class Accounts, and move it to...

    (How do I remove the STATIC ArrayList from the public class Accounts, and move it to the MAIN?) import java.util.ArrayList; import java.util.Scanner; public class Accounts { static ArrayList<String> accounts = new ArrayList<>(); static Scanner scanner = new Scanner(System.in);    public static void main(String[] args) { Scanner scanner = new Scanner(System.in);    int option = 0; do { System.out.println("0->quit\n1->add\n2->overwirte\n3->remove\n4->display"); System.out.println("Enter your option"); option = scanner.nextInt(); if (option == 0) { break; } else if (option == 1) { add(); } else...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT