Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What is the output of the second 'println' statement in the main method: public class A { int i; static int s; public static void

image text in transcribed
What is the output of the second 'println' statement in the main method: public class A { int i; static int s; public static void main(String( args) { A a1 = new A(); System.out.println("A1.lis " + a1.1 +"A1.s is " + a1.s); A a2 = a1; System.out.println("A2.1 is " + a2.1 + "A2.s is " + a2.s); A a3 = new A(); System.out.println("A3.1 is " + a3.1+" A3.s is " + a3.s); } public A() { i++; S++; } } O A2.i is 2 A2.s is 1 A2.i is 2 A2.s is 2 O A2.i is 1 A2.s is 2 A2.iis 1 A2.s is 1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Murach's SQL Server 2012 For Developers

Authors: Bryan Syverson, Joel Murach, Mike Murach

1st Edition

1890774693, 9781890774691

More Books

Students also viewed these Databases questions