The program below produces 4 lines of output. What are they? public class VerySimplePoint { int x; int y; public VerySim

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
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

Post by answerhappygod »

The Program Below Produces 4 Lines Of Output What Are They Public Class Verysimplepoint Int X Int Y Public Verysim 1
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 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:
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply