Write the output of the following program, as it would appear on the console. import java.util.*; // for Arrays class public class BasicPoint { int x; int y; public BasicPoint(int initialx, int initialY) { x = initialx; y = initialY; public class ReferenceMystery { public static void main(String args) { BasicPoint p = new BasicPoint(11, 22); int a = {33, 44}; int n - 55: System.out.println(p.x + "," + p.y + "" mystery(p, a, n); System.out.printin(p.x + "," + p.y + Arrays.toString(a) + "" + n); Arrays.toString(a) + " " + n); a[0] = a[1]; p.x = p.y; mystery(p, а, n); System.out.printin(p.x + "," + p.y + "" + Arrays.toString(a) + " " + n); public static int mystery(BasicPoint p, int0 a, int n) { n = 0; a[0] = a[0] + 11; a[1] - 77; p.x - p.x + 33; System.out.println(p.x + "," + p.y + "" + Arrays.toString(a) + "" + n); return n; }

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter2: Using Data
Section: Chapter Questions
Problem 14RQ
icon
Related questions
Question

must be done in java and used for file name public class Main like in second pic 

Reference Semantics Mystery
Write the output of the following program, as it would appear on the console.
import java.util.*;
// for Arrays class
public class BasicPoint {
int x;
int y;
public BasicPoint(int initialX, int initialY) {
x = initialX;
y = initialY;
}
public class ReferenceMystery {
public static void main(StringO args) {
BasicPoint p = new BasicPoint(11, 22);
int[] a = {33, 44};
int n = 55;
+ Arrays.toString(a) + " " + n);
System.out.println(p.x + "," + p.y +
mystery(p, a, n);
System.out.println(p.x +
+ p.y + "
+ Arrays.toString(a) +
+ n);
a[0] = a[1];
p.x = p.y;
mystery(p, a, n);
System.out.printin(p.x + "," + p.y + " " + Arrays.toString(a) + " " + n);
public static int mystery(BasicPoint p, int[] a, int n) {
n = 0;
a[0] = a[0] + 11;
a[1] - 77;
p.X = p.x + 33;
System.out.println(p.x + "," + p.y + " " + Arrays.toString(a) + " " + n);
return n;
Transcribed Image Text:Reference Semantics Mystery Write the output of the following program, as it would appear on the console. import java.util.*; // for Arrays class public class BasicPoint { int x; int y; public BasicPoint(int initialX, int initialY) { x = initialX; y = initialY; } public class ReferenceMystery { public static void main(StringO args) { BasicPoint p = new BasicPoint(11, 22); int[] a = {33, 44}; int n = 55; + Arrays.toString(a) + " " + n); System.out.println(p.x + "," + p.y + mystery(p, a, n); System.out.println(p.x + + p.y + " + Arrays.toString(a) + + n); a[0] = a[1]; p.x = p.y; mystery(p, a, n); System.out.printin(p.x + "," + p.y + " " + Arrays.toString(a) + " " + n); public static int mystery(BasicPoint p, int[] a, int n) { n = 0; a[0] = a[0] + 11; a[1] - 77; p.X = p.x + 33; System.out.println(p.x + "," + p.y + " " + Arrays.toString(a) + " " + n); return n;
1 v class Main {
public static void main(String[] args) {
H N M 4
Transcribed Image Text:1 v class Main { public static void main(String[] args) { H N M 4
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Adjacency Matrix
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT