- The Program Below Produces 4 Lines Of Output What Are They Public Class Verysimplepoint Int X Int Y Public Verysim 1 (123.74 KiB) Viewed 28 times
The program below produces 4 lines of output. What are they? public class VerySimplePoint { int x; int y; public VerySim
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
The program below produces 4 lines of output. What are they? public class VerySimplePoint { int x; int y; public VerySim
The program below produces 4 lines of output. What are they? public class VerySimplePoint { int x; int y; public VerySimplePoint() { x = 2; y = 2; } } class Mystery { public static void main(String[] args) { int a = 7; int b = 9; VerySimplePoint pl = new VerySimplePoint(); VerySimplePoint p2 = new VerySimplePoint(); addToXTwice(a,p1); System.out.println(a + + b + + p1.X + addToxTwice(b,p2); System.out.println(a + + b + + p1.x + } + p2.x); + p2.x); public static void addToXTwice(int a, VerySimplePoint p1) { a = a + a; p1.x += a; System.out.println(a + " + p1.x); } } Line 1: Line 2: Line 3: Line 4: